xref: /llvm-project/lldb/test/API/functionalities/ptrauth_diagnostics/LDRAA_error/ldraa.c (revision 66902a32c83809d26662f76e4107d5dd777610c3)

main()1 int main() {
2   //% self.filecheck("c", "ldraa.c")
3   // CHECK: EXC_BAD_ACCESS
4   // CHECK-NEXT: Note: Possible pointer authentication failure detected.
5   // CHECK-NEXT: Found authenticated load instruction at address=0x{{.*}} (ldraa.c:[[@LINE+3]]:3).
6   long long foo = 0;
7 
8   asm volatile (
9       "ldraa x9, [%[target]] \n"
10       /* Outputs */  :
11       /* Inputs */   : [target] "r"(&foo)
12       /* Clobbers */ :
13   );
14 
15   return 1;
16 }
17 
18 // Expected codegen, register state, and exception message without ptrauth diagnostics:
19 // * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2000016fdffc38)
20 //     frame #0: 0x0000000100007fa8 ldraa`main + 12
21 // ldraa`main:
22 // ->  0x100007fa8 <+12>: ldraa  x9, [x8]
23 //     0x100007fac <+16>: orr    w0, wzr, #0x1
24 //     0x100007fb0 <+20>: add    sp, sp, #0x10             ; =0x10
25 //     0x100007fb4 <+24>: ret
26 // Target 0: (ldraa) stopped.
27 // (lldb) p/x $x8
28 // (unsigned long) $0 = 0x000000016fdffc38
29 // (lldb) x/8 $x8
30 // 0x16fdffc38: 0x00000000 0x00000000 0x80254f30 0x00000001
31 // 0x16fdffc48: 0x00000000 0x00000000 0x00000000 0x00000000
32