Skip to content

Commit 4eadb45

Browse files
committed
[lldb][NFC] Try to adapt Cortex-M API test for an Unbuntu bot
When I added support for the Cortex-M exception return unwinding, I got CI test failures on the lldb-remote-linux-ubuntu bot. The triple from my test `binary.json`, "armv7m-apple", was not being used for the Target, so the incorrect SysV / AAPCS ABI was being selected, and that ABI plugin has default unwind plans that hardcode the arm-code r11 frame pointer behavior. This is a Cortex-M core, and r7 should be used. The Darwin Arm ABI plugin uses r7 for both arm and thumb, and behaves correctly. Try getting the triple from `binary.json` in the API test, creating the target with that triple explicitly before loading the corefile. This may help prevent however we were losing the "-apple-" part of the triple. We'll see what the CI bot looks like with this added.
1 parent b8e1cc5 commit 4eadb45

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,16 @@
1212
class TestCortexMExceptionUnwind(TestBase):
1313
NO_DEBUG_INFO_TESTCASE = True
1414

15-
# on the lldb-remote-linux-ubuntu CI, the binary.json's triple of
16-
# armv7m-apple is not being set in the Target triple, and we're
17-
# picking the wrong ABI plugin, ABISysV_arm.
18-
# ABISysV_arm::CreateDefaultUnwindPlan() doesn't have a way to detect
19-
# arm/thumb for a stack frame, or even the Target's triple for a
20-
# Cortex-M part that is always thumb. It hardcodes r11 as the frame
21-
# pointer register, which is correct for arm code but not thumb.
22-
# It is never correct # on a Cortex-M target.
23-
# The Darwin ABIMacOSX_arm diverges from AAPCS and always uses r7 for
24-
# the frame pointer -- the thumb convention -- whether executing arm or
25-
# thumb. So its CreateDefaultUnwindPlan picks the correct register for
26-
# the frame pointer, and we can walk the stack.
27-
# ABISysV_arm::CreateDefaultUnwindPlan will only get one frame and
28-
# not be able to continue.
29-
#
30-
# This may only be occuring on a 32-bit Ubuntu bot; need to test
31-
# 64-bit Ubuntu and confirm.
32-
@skipUnlessDarwin
3315
def test_no_fpu(self):
3416
"""Test that we can backtrace correctly through an ARM Cortex-M Exception return stack"""
3517

36-
target = self.dbg.CreateTarget("")
3718
exe = "binary.json"
3819
with open(exe) as f:
3920
exe_json = json.load(f)
4021
exe_uuid = exe_json["uuid"]
22+
triple = exe_json["triple"]
4123

42-
target.AddModule(exe, "", exe_uuid)
24+
target = self.dbg.CreateTargetWithFileAndTargetTriple(exe, triple)
4325
self.assertTrue(target.IsValid())
4426

4527
core = self.getBuildArtifact("core")

0 commit comments

Comments
 (0)