Author: Med Ismail Bennani
Date: 2025-12-02T16:39:33-08:00
New Revision: b30a48c389cee20479419a672d841cb32eaf107a

URL: 
https://github.com/llvm/llvm-project/commit/b30a48c389cee20479419a672d841cb32eaf107a
DIFF: 
https://github.com/llvm/llvm-project/commit/b30a48c389cee20479419a672d841cb32eaf107a.diff

LOG: [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]>

Added: 
    

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

Removed: 
    


################################################################################
diff  --git 
a/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py
 
b/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py
index 3c0390ef72fd2..1ae0a17814e89 100644
--- 
a/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py
+++ 
b/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py
@@ -5,6 +5,7 @@
 import os
 
 import lldb
+import lldbsuite.test.lldbplatformutil as lldbplatformutil
 from lldbsuite.test.lldbtest import TestBase
 from lldbsuite.test import lldbutil
 
@@ -208,6 +209,10 @@ def test_applies_to_thread(self):
 
         # Check each thread
         thread_id_1_found = False
+        # On ARM32, FixCodeAddress clears bit 0, so synthetic PCs get modified
+        is_arm_32bit = lldbplatformutil.getArchitecture() == "arm"
+        expected_synthetic_pc = 0xFFFE if is_arm_32bit else 0xFFFF
+
         for i in range(num_threads):
             t = process.GetThreadAtIndex(i)
             thread_id = t.GetIndexID()
@@ -222,8 +227,8 @@ def test_applies_to_thread(self):
                 )
                 self.assertEqual(
                     t.GetFrameAtIndex(0).GetPC(),
-                    0xFFFF,
-                    f"Thread with ID 1 should have synthetic PC 0xFFFF",
+                    expected_synthetic_pc,
+                    f"Thread with ID 1 should have synthetic PC 
{expected_synthetic_pc:#x}",
                 )
             else:
                 # Other threads should keep their original frames
@@ -391,13 +396,17 @@ def test_circular_dependency_fix(self):
             "Should have original frames + 1 synthetic frame",
         )
 
+        # On ARM32, FixCodeAddress clears bit 0, so synthetic PCs get modified
+        is_arm_32bit = lldbplatformutil.getArchitecture() == "arm"
+        expected_synthetic_pc = 0xDEADBEEE if is_arm_32bit else 0xDEADBEEF
+
         # First frame should be synthetic
         frame0 = thread.GetFrameAtIndex(0)
         self.assertIsNotNone(frame0)
         self.assertEqual(
             frame0.GetPC(),
-            0xDEADBEEF,
-            "First frame should be synthetic frame with PC 0xDEADBEEF",
+            expected_synthetic_pc,
+            f"First frame should be synthetic frame with PC 
{expected_synthetic_pc:#x}",
         )
 
         # Second frame should be the original first frame


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to