[Lldb-commits] [lldb] [lldb] Support PtrAuth in the expression evaluator (PR #186001)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 12 03:30:36 PDT 2026


================
@@ -0,0 +1,29 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestPtrAuthFixups(TestBase):
+    @skipUnlessDarwin
+    @skipUnlessArch("arm64")
+    def test_static_function_pointer(self):
+        """Test that a static function pointer initialized in an expression
+        gets correctly signed on arm64e via the pointer signing fixup pass."""
+        self.build()
+
+        lldbutil.run_to_source_breakpoint(
+            self, "// break here", lldb.SBFileSpec("main.c", False)
+        )
+
+        self.expect_expr(
+            "static int (*fp)(int, int) = &add; fp(5, 6);",
+            result_type="int",
+            result_value="11",
+        )
+
+        self.expect_expr(
+            "static int (*fp)(int, int) = &mul; fp(4, 5);",
+            result_type="int",
+            result_value="20",
+        )
----------------
DavidSpickett wrote:

Do you actually need two of them, is there something different about the second one regarding the signing?

Perhaps it is that part of the signing discriminator / salt / whatever the term is, is the function's address? And so we want to make sure we don't just get lucky?

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


More information about the lldb-commits mailing list