Skip to content

Commit b30a48c

Browse files
committed
[lldb/test] Fix scripted frame provider tests on ARM32
On ARM32, FixCodeAddress unconditionally clears bit 0 (the Thumb bit) from all code addresses, including synthetic frame PCs. This causes test failures where synthetic PCs like 0xFFFF and 0xDEADBEEF become 0xFFFE and 0xDEADBEEE respectively. This adjusts the tests to expect the modified PC values on ARM32. Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent e05fffb commit b30a48c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66

77
import lldb
8+
import lldbsuite.test.lldbplatformutil as lldbplatformutil
89
from lldbsuite.test.lldbtest import TestBase
910
from lldbsuite.test import lldbutil
1011

@@ -208,6 +209,10 @@ def test_applies_to_thread(self):
208209

209210
# Check each thread
210211
thread_id_1_found = False
212+
# On ARM32, FixCodeAddress clears bit 0, so synthetic PCs get modified
213+
is_arm_32bit = lldbplatformutil.getArchitecture() == "arm"
214+
expected_synthetic_pc = 0xFFFE if is_arm_32bit else 0xFFFF
215+
211216
for i in range(num_threads):
212217
t = process.GetThreadAtIndex(i)
213218
thread_id = t.GetIndexID()
@@ -222,8 +227,8 @@ def test_applies_to_thread(self):
222227
)
223228
self.assertEqual(
224229
t.GetFrameAtIndex(0).GetPC(),
225-
0xFFFF,
226-
f"Thread with ID 1 should have synthetic PC 0xFFFF",
230+
expected_synthetic_pc,
231+
f"Thread with ID 1 should have synthetic PC {expected_synthetic_pc:#x}",
227232
)
228233
else:
229234
# Other threads should keep their original frames
@@ -391,13 +396,17 @@ def test_circular_dependency_fix(self):
391396
"Should have original frames + 1 synthetic frame",
392397
)
393398

399+
# On ARM32, FixCodeAddress clears bit 0, so synthetic PCs get modified
400+
is_arm_32bit = lldbplatformutil.getArchitecture() == "arm"
401+
expected_synthetic_pc = 0xDEADBEEE if is_arm_32bit else 0xDEADBEEF
402+
394403
# First frame should be synthetic
395404
frame0 = thread.GetFrameAtIndex(0)
396405
self.assertIsNotNone(frame0)
397406
self.assertEqual(
398407
frame0.GetPC(),
399-
0xDEADBEEF,
400-
"First frame should be synthetic frame with PC 0xDEADBEEF",
408+
expected_synthetic_pc,
409+
f"First frame should be synthetic frame with PC {expected_synthetic_pc:#x}",
401410
)
402411

403412
# Second frame should be the original first frame

0 commit comments

Comments
 (0)