diff --git a/utils/debug.cc b/utils/debug.cc index ec47827..fb08b50 100644 --- a/utils/debug.cc +++ b/utils/debug.cc @@ -88,7 +88,9 @@ static stack_t __sigstack; static void sigsegv_handler(int sig, siginfo_t *siginfo, void *context) { ucontext_t* u = (ucontext_t*)context; -#ifdef REG_RIP // Test if the Program Counter is 64 bits +#if defined(__aarch64__) + unsigned char *pc = (unsigned char*)u->uc_mcontext.pc; +#elif defined(REG_RIP) // Test if the Program Counter is 64 bits unsigned char *pc = (unsigned char *)u->uc_mcontext.gregs[REG_RIP]; #else // 32 bit machine, PC is stored in %eip register unsigned char *pc = (unsigned char *)u->uc_mcontext.gregs[REG_EIP];