xref: /llvm-project/lldb/test/API/macosx/ptrauth-address-expressions/TestPtrauthAddressExpressions.py (revision 484bc2bcc7990f4ecaf40f3d806ed870cdbdfd95)
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
8class TestPtrauthAddressExpressions(TestBase):
9
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
16    def test(self):
17
18        # Skip this test if not running on AArch64 target that supports PAC
19        if not self.isAArch64PAuth():
20            self.skipTest('Target must support pointer authentication.')
21        self.source = 'main.c'
22        self.build()
23        (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
24                           "break here", lldb.SBFileSpec(self.source, False))
25
26        self.expect("p fptr", substrs=[self.source])
27        self.expect("ima loo -va fptr", substrs=[self.source])
28        self.expect("break set -a fptr", substrs=[self.source])
29