Files
clang-p2996/lldb/test/API/functionalities/unwind/aarch64_unwind_pac/main.c
Muhammad Omair Javaid e8f998c0c5 AArch64 Linux and elf-core PAC stack unwinder support
This patch builds on D100521 and other related patches to add support
for unwinding stack on AArch64 systems with pointer authentication
feature enabled.

We override FixCodeAddress and FixDataAddress function in ABISysV_arm64
class. We now try to calculate and set code and data masks after reading
data_mask and code_mask registers exposed by AArch64 targets running Linux.

This patch utilizes core file linux-aarch64-pac.core for testing that
LLDB can successfully unwind stack frames in the presence of signed
return address after masking off ignored bits.

This patch also includes a AArch64 Linux native test case to demonstrate
successful back trace calculation in presence of pointer authentication
feature.

Differential Revision: https://reviews.llvm.org/D99944
2021-06-16 02:09:46 +05:00

25 lines
589 B
C

// This program makes a multi tier nested function call to test AArch64
// Pointer Authentication feature.
// To enable PAC return address signing compile with following clang arguments:
// -march=armv8.3-a -mbranch-protection=pac-ret+leaf
#include <stdlib.h>
static void __attribute__((noinline)) func_c(void) {
exit(0); // Frame func_c
}
static void __attribute__((noinline)) func_b(void) {
func_c(); // Frame func_b
}
static void __attribute__((noinline)) func_a(void) {
func_b(); // Frame func_a
}
int main(int argc, char *argv[]) {
func_a(); // Frame main
return 0;
}