xref: /llvm-project/lldb/test/API/linux/aarch64/non_address_bit_code_break/main.c (revision e6ec76c647aaa335de48b8534d3a044346d9656f)
1 #include <stdint.h>
2 
foo(void)3 void foo(void) {}
4 typedef void (*FooPtr)(void);
5 
main()6 int main() {
7   FooPtr fnptr = foo;
8   // Set top byte.
9   fnptr = (FooPtr)((uintptr_t)fnptr | (uintptr_t)0xff << 56);
10   // Then apply a PAuth signature to it.
11   __asm__ __volatile__("pacdza %0" : "=r"(fnptr) : "r"(fnptr));
12   // fnptr is now:
13   // <8 bit top byte tag><pointer signature><virtual address>
14 
15   foo(); // Set break point at this line.
16 
17   return 0;
18 }
19