xref: /llvm-project/lldb/test/API/macosx/ptrauth-address-expressions/TestPtrauthAddressExpressions.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""Test that AArch64 PAC bits are stripped from address expression arguments"""
2
3import lldb
4from lldbsuite.test.decorators import *
5from lldbsuite.test.lldbtest import *
6from lldbsuite.test import lldbutil
7
8
9class TestPtrauthAddressExpressions(TestBase):
10    NO_DEBUG_INFO_TESTCASE = True
11
12    # On Darwin systems, arch arm64e means ARMv8.3 with ptrauth
13    # ABI used.
14    @skipIf(archs=no_match(["arm64e"]))
15    def test(self):
16        # Skip this test if not running on AArch64 target that supports PAC
17        if not self.isAArch64PAuth():
18            self.skipTest("Target must support pointer authentication.")
19        self.source = "main.c"
20        self.build()
21        (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
22            self, "break here", lldb.SBFileSpec(self.source, False)
23        )
24
25        self.expect("p fptr", substrs=[self.source])
26        self.expect("ima loo -va fptr", substrs=[self.source])
27        self.expect("break set -a fptr", substrs=[self.source])
28