From d217893e06bd7f5bcf2d43fdfd1e38ce595468f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trung=20L=C3=AA?= <8@tle.id.au> Date: Sun, 1 Mar 2026 00:39:37 +1100 Subject: [PATCH] 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 --- renderdoc/os/posix/linux/linux_process.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/renderdoc/os/posix/linux/linux_process.cpp b/renderdoc/os/posix/linux/linux_process.cpp index 73510e2f7..c9eece97b 100644 --- a/renderdoc/os/posix/linux/linux_process.cpp +++ b/renderdoc/os/posix/linux/linux_process.cpp @@ -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