[Lldb-commits] [lldb] [lldb] Update TestObjcOptimized.py for MTE (PR #186042)

via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 11 23:36:05 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

Use process.FixAddress to strip the top byte when running under MTE.

---
Full diff: https://github.com/llvm/llvm-project/pull/186042.diff


1 Files Affected:

- (modified) lldb/test/API/lang/objc/objc-optimized/TestObjcOptimized.py (+13-1) 


``````````diff
diff --git a/lldb/test/API/lang/objc/objc-optimized/TestObjcOptimized.py b/lldb/test/API/lang/objc/objc-optimized/TestObjcOptimized.py
index 1d74047a49bd1..713c79b4630c7 100644
--- a/lldb/test/API/lang/objc/objc-optimized/TestObjcOptimized.py
+++ b/lldb/test/API/lang/objc/objc-optimized/TestObjcOptimized.py
@@ -57,10 +57,22 @@ def test_break(self):
         if mo:
             desired_pointer = mo.group(0)
 
+        # Use FixAddress to strip top-byte metadata (ObjC ISA tags, MTE tags)
+        # because `frame variable` and `expression` may report different
+        # top-byte values.
+        process = self.dbg.GetSelectedTarget().GetProcess()
+        desired_addr = process.FixAddress(int(desired_pointer, 16))
+
         self.expect(
             "expression (self)",
-            substrs=[("(%s *) $1 = " % self.myclass), desired_pointer],
+            substrs=[("(%s *) $1 = " % self.myclass)],
         )
+        interp.HandleCommand("expression (self)", result)
+        expr_output = result.GetOutput()
+        mo = re.search("0x[0-9a-f]+", expr_output)
+        self.assertTrue(mo, "Expected a pointer in expression output")
+        expr_addr = process.FixAddress(int(mo.group(0), 16))
+        self.assertEqual(desired_addr, expr_addr)
 
         self.expect(
             "expression self->non_member",

``````````

</details>


https://github.com/llvm/llvm-project/pull/186042


More information about the lldb-commits mailing list