Add ppc64le architecture support for ptrace process tracing

On ppc64le (PowerPC 64-bit little-endian), the register struct is
pt_regs (from asm/ptrace.h) rather than user_regs_struct, and the
instruction pointer register is 'nip'. Without this, the code falls
through to the x86 #else branch which fails to compile because
user_regs_struct does not exist on ppc64le.

Define the appropriate macros:
- Map user_regs_struct to pt_regs
- Set INST_PTR_REG to nip
- Set BREAK_INST to 0x7fe00008 (ppc64 trap instruction)
- Set BREAK_INST_BYTES_SIZE to 4
- Set BREAK_INST_INST_PTR_ADJUST to 0
This commit is contained in:
Trung Lê
2026-03-01 00:39:37 +11:00
committed by Baldur Karlsson
parent 4afec0d8af
commit d217893e06
@@ -243,6 +243,16 @@ static uint64_t get_nanotime()
#define BREAK_INST_BYTES_SIZE 4
#define BREAK_INST_INST_PTR_ADJUST 4
#elif defined(__powerpc64__)
#define user_regs_struct pt_regs
#define INST_PTR_REG nip
// trap instruction on ppc64
#define BREAK_INST 0x7fe00008ULL
#define BREAK_INST_BYTES_SIZE 4
#define BREAK_INST_INST_PTR_ADJUST 0
#else
#define BREAK_INST 0xccULL