diff --git a/Makefile.am b/Makefile.am index 0052d0e1..624807bd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -227,7 +227,6 @@ EXTRA_DIST = \ linux/aarch64/ioctls_arch1.h \ linux/aarch64/ioctls_inc0.h \ linux/aarch64/ioctls_inc1.h \ - linux/aarch64/print_pc.c \ linux/aarch64/signalent1.h \ linux/aarch64/syscallent.h \ linux/aarch64/syscallent1.h \ @@ -242,7 +241,6 @@ EXTRA_DIST = \ linux/alpha/get_syscall_result.c\ linux/alpha/ioctls_arch0.h \ linux/alpha/ioctls_inc0.h \ - linux/alpha/print_pc.c \ linux/alpha/signalent.h \ linux/alpha/syscallent.h \ linux/alpha/userent.h \ @@ -252,7 +250,6 @@ EXTRA_DIST = \ linux/arc/get_syscall_args.c \ linux/arc/ioctls_arch0.h \ linux/arc/ioctls_inc0.h \ - linux/arc/print_pc.c \ linux/arc/syscallent.h \ linux/arch_regs.h \ linux/arch_sigreturn.c \ @@ -264,7 +261,6 @@ EXTRA_DIST = \ linux/arm/get_syscall_args.c \ linux/arm/ioctls_arch0.h \ linux/arm/ioctls_inc0.h \ - linux/arm/print_pc.c \ linux/arm/syscallent.h \ linux/arm/userent.h \ linux/avr32/arch_regs.c \ @@ -273,7 +269,6 @@ EXTRA_DIST = \ linux/avr32/get_syscall_args.c \ linux/avr32/ioctls_arch0.h \ linux/avr32/ioctls_inc0.h \ - linux/avr32/print_pc.c \ linux/avr32/syscallent.h \ linux/avr32/userent.h \ linux/bfin/arch_regs.c \ @@ -283,7 +278,6 @@ EXTRA_DIST = \ linux/bfin/get_syscall_result.c \ linux/bfin/ioctls_arch0.h \ linux/bfin/ioctls_inc0.h \ - linux/bfin/print_pc.c \ linux/bfin/syscallent.h \ linux/bfin/userent.h \ linux/crisv10/arch_regs.c \ @@ -292,7 +286,6 @@ EXTRA_DIST = \ linux/crisv10/get_scno.c \ linux/crisv10/get_syscall_args.c \ linux/crisv10/get_syscall_result.c \ - linux/crisv10/print_pc.c \ linux/crisv10/userent.h \ linux/crisv32/arch_regs.c \ linux/crisv32/arch_sigreturn.c \ @@ -300,7 +293,6 @@ EXTRA_DIST = \ linux/crisv32/get_scno.c \ linux/crisv32/get_syscall_args.c \ linux/crisv32/get_syscall_result.c \ - linux/crisv32/print_pc.c \ linux/crisv32/userent.h \ linux/dummy.h \ linux/errnoent.h \ @@ -313,7 +305,6 @@ EXTRA_DIST = \ linux/hppa/get_syscall_result.c \ linux/hppa/ioctls_arch0.h \ linux/hppa/ioctls_inc0.h \ - linux/hppa/print_pc.c \ linux/hppa/signalent.h \ linux/hppa/syscallent.h \ linux/i386/arch_regs.c \ @@ -324,7 +315,6 @@ EXTRA_DIST = \ linux/i386/get_syscall_args.c \ linux/i386/ioctls_arch0.h \ linux/i386/ioctls_inc0.h \ - linux/i386/print_pc.c \ linux/i386/syscallent.h \ linux/i386/userent.h \ linux/i386/userent0.h \ @@ -337,7 +327,6 @@ EXTRA_DIST = \ linux/ia64/get_syscall_args.c \ linux/ia64/ioctls_arch0.h \ linux/ia64/ioctls_inc0.h \ - linux/ia64/print_pc.c \ linux/ia64/syscallent.h \ linux/ia64/userent.h \ linux/inet_diag.h \ @@ -349,7 +338,6 @@ EXTRA_DIST = \ linux/m68k/get_syscall_result.c \ linux/m68k/ioctls_arch0.h \ linux/m68k/ioctls_inc0.h \ - linux/m68k/print_pc.c \ linux/m68k/syscallent.h \ linux/m68k/userent.h \ linux/metag/arch_regs.c \ @@ -358,7 +346,6 @@ EXTRA_DIST = \ linux/metag/get_syscall_args.c \ linux/metag/ioctls_arch0.h \ linux/metag/ioctls_inc0.h \ - linux/metag/print_pc.c \ linux/metag/syscallent.h \ linux/microblaze/arch_regs.c \ linux/microblaze/arch_sigreturn.c \ @@ -368,7 +355,6 @@ EXTRA_DIST = \ linux/microblaze/get_syscall_result.c \ linux/microblaze/ioctls_arch0.h \ linux/microblaze/ioctls_inc0.h \ - linux/microblaze/print_pc.c \ linux/microblaze/syscallent.h \ linux/microblaze/userent.h \ linux/mips/arch_getrval2.c \ @@ -382,7 +368,6 @@ EXTRA_DIST = \ linux/mips/get_syscall_args.c \ linux/mips/ioctls_arch0.h \ linux/mips/ioctls_inc0.h \ - linux/mips/print_pc.c \ linux/mips/signalent.h \ linux/mips/syscallent-compat.h \ linux/mips/syscallent-n32.h \ @@ -397,7 +382,6 @@ EXTRA_DIST = \ linux/nios2/get_syscall_args.c \ linux/nios2/ioctls_arch0.h \ linux/nios2/ioctls_inc0.h \ - linux/nios2/print_pc.c \ linux/nios2/syscallent.h \ linux/or1k/arch_regs.c \ linux/or1k/get_error.c \ @@ -405,7 +389,6 @@ EXTRA_DIST = \ linux/or1k/get_syscall_args.c \ linux/or1k/ioctls_arch0.h \ linux/or1k/ioctls_inc0.h \ - linux/or1k/print_pc.c \ linux/or1k/syscallent.h \ linux/or1k/userent.h \ linux/personality.h \ @@ -419,7 +402,6 @@ EXTRA_DIST = \ linux/powerpc/getregs_old.c \ linux/powerpc/ioctls_arch0.h \ linux/powerpc/ioctls_inc0.h \ - linux/powerpc/print_pc.c \ linux/powerpc/syscallent.h \ linux/powerpc/userent.h \ linux/powerpc64/arch_regs.c \ @@ -435,7 +417,6 @@ EXTRA_DIST = \ linux/powerpc64/ioctls_arch1.h \ linux/powerpc64/ioctls_inc0.h \ linux/powerpc64/ioctls_inc1.h \ - linux/powerpc64/print_pc.c \ linux/powerpc64/signalent1.h \ linux/powerpc64/syscallent.h \ linux/powerpc64/syscallent1.h \ @@ -449,7 +430,6 @@ EXTRA_DIST = \ linux/s390/get_syscall_args.c \ linux/s390/ioctls_arch0.h \ linux/s390/ioctls_inc0.h \ - linux/s390/print_pc.c \ linux/s390/syscallent.h \ linux/s390/userent.h \ linux/s390/userent0.h \ @@ -462,7 +442,6 @@ EXTRA_DIST = \ linux/s390x/get_syscall_args.c \ linux/s390x/ioctls_arch0.h \ linux/s390x/ioctls_inc0.h \ - linux/s390x/print_pc.c \ linux/s390x/syscallent.h \ linux/s390x/userent.h \ linux/sh/arch_getrval2.c \ @@ -473,7 +452,6 @@ EXTRA_DIST = \ linux/sh/get_syscall_result.c \ linux/sh/ioctls_arch0.h \ linux/sh/ioctls_inc0.h \ - linux/sh/print_pc.c \ linux/sh/syscallent.h \ linux/sh/userent.h \ linux/sh/userent0.h \ @@ -485,7 +463,6 @@ EXTRA_DIST = \ linux/sh64/get_syscall_result.c \ linux/sh64/ioctls_arch0.h \ linux/sh64/ioctls_inc0.h \ - linux/sh64/print_pc.c \ linux/sh64/syscallent.h \ linux/sh64/userent.h \ linux/signalent.h \ @@ -501,7 +478,6 @@ EXTRA_DIST = \ linux/sparc/get_syscall_args.c \ linux/sparc/ioctls_arch0.h \ linux/sparc/ioctls_inc0.h \ - linux/sparc/print_pc.c \ linux/sparc/signalent.h \ linux/sparc/syscallent.h \ linux/sparc/userent.h \ @@ -518,7 +494,6 @@ EXTRA_DIST = \ linux/sparc64/ioctls_arch1.h \ linux/sparc64/ioctls_inc0.h \ linux/sparc64/ioctls_inc1.h \ - linux/sparc64/print_pc.c \ linux/sparc64/signalent.h \ linux/sparc64/signalent1.h \ linux/sparc64/syscallent.h \ @@ -537,7 +512,6 @@ EXTRA_DIST = \ linux/tile/ioctls_arch1.h \ linux/tile/ioctls_inc0.h \ linux/tile/ioctls_inc1.h \ - linux/tile/print_pc.c \ linux/tile/signalent1.h \ linux/tile/syscallent.h \ linux/tile/syscallent1.h \ @@ -557,7 +531,6 @@ EXTRA_DIST = \ linux/x32/ioctls_arch1.h \ linux/x32/ioctls_inc0.h \ linux/x32/ioctls_inc1.h \ - linux/x32/print_pc.c \ linux/x32/signalent1.h \ linux/x32/syscallent.h \ linux/x32/syscallent1.h \ @@ -578,7 +551,6 @@ EXTRA_DIST = \ linux/x86_64/ioctls_inc0.h \ linux/x86_64/ioctls_inc1.h \ linux/x86_64/ioctls_inc2.h \ - linux/x86_64/print_pc.c \ linux/x86_64/signalent1.h \ linux/x86_64/signalent2.h \ linux/x86_64/syscallent.h \ @@ -592,7 +564,6 @@ EXTRA_DIST = \ linux/xtensa/get_syscall_result.c \ linux/xtensa/ioctls_arch0.h \ linux/xtensa/ioctls_inc0.h \ - linux/xtensa/print_pc.c \ linux/xtensa/syscallent.h \ linux/xtensa/userent.h \ maint/ioctls_gen.sh \ diff --git a/linux/aarch64/arch_regs.c b/linux/aarch64/arch_regs.c index 3b9c2f64..78b74708 100644 --- a/linux/aarch64/arch_regs.c +++ b/linux/aarch64/arch_regs.c @@ -35,3 +35,4 @@ static struct iovec aarch64_io = { #define ARCH_REGS_FOR_GETREGSET arm_regs_union #define ARCH_IOVEC_FOR_GETREGSET aarch64_io +#define ARCH_PC_REG ((aarch64_io.iov_len == sizeof(arm_regs)) ? arm_regs.ARM_pc : aarch64_regs.pc) diff --git a/linux/aarch64/print_pc.c b/linux/aarch64/print_pc.c deleted file mode 100644 index 23c0e5cb..00000000 --- a/linux/aarch64/print_pc.c +++ /dev/null @@ -1,4 +0,0 @@ -if (aarch64_io.iov_len == sizeof(arm_regs)) - tprintf(fmt, (unsigned long) arm_regs.ARM_pc); -else - tprintf(fmt, (unsigned long) aarch64_regs.pc); diff --git a/linux/alpha/arch_regs.c b/linux/alpha/arch_regs.c index e2783ca4..df1878e2 100644 --- a/linux/alpha/arch_regs.c +++ b/linux/alpha/arch_regs.c @@ -1,2 +1,3 @@ static long alpha_r0; static long alpha_a3; +#define ARCH_PC_PEEK_ADDR REG_PC diff --git a/linux/alpha/print_pc.c b/linux/alpha/print_pc.c deleted file mode 100644 index c0232e55..00000000 --- a/linux/alpha/print_pc.c +++ /dev/null @@ -1,6 +0,0 @@ -long pc; -if (upeek(tcp->pid, REG_PC, &pc) < 0) { - PRINTBADPC; - return; -} -tprintf(fmt, pc); diff --git a/linux/arc/arch_regs.c b/linux/arc/arch_regs.c index 0d57ae4e..18460080 100644 --- a/linux/arc/arch_regs.c +++ b/linux/arc/arch_regs.c @@ -1,2 +1,3 @@ static struct user_regs_struct arc_regs; #define ARCH_REGS_FOR_GETREGSET arc_regs +#define ARCH_PC_REG arc_regs.efa diff --git a/linux/arc/print_pc.c b/linux/arc/print_pc.c deleted file mode 100644 index f904544a..00000000 --- a/linux/arc/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, arc_regs.efa); diff --git a/linux/arm/arch_regs.c b/linux/arm/arch_regs.c index ca1fb6d9..f5c02f0d 100644 --- a/linux/arm/arch_regs.c +++ b/linux/arm/arch_regs.c @@ -2,3 +2,4 @@ static struct pt_regs arm_regs; long *const arm_sp_ptr = &arm_regs.ARM_sp; #define ARCH_REGS_FOR_GETREGS arm_regs +#define ARCH_PC_REG arm_regs.ARM_pc diff --git a/linux/arm/print_pc.c b/linux/arm/print_pc.c deleted file mode 100644 index b9d9622f..00000000 --- a/linux/arm/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, arm_regs.ARM_pc); diff --git a/linux/avr32/arch_regs.c b/linux/avr32/arch_regs.c index aab03389..8b52a8d0 100644 --- a/linux/avr32/arch_regs.c +++ b/linux/avr32/arch_regs.c @@ -1,2 +1,3 @@ static struct pt_regs avr32_regs; #define ARCH_REGS_FOR_GETREGS avr32_regs +#define ARCH_PC_REG avr32_regs.pc diff --git a/linux/avr32/print_pc.c b/linux/avr32/print_pc.c deleted file mode 100644 index ca293e63..00000000 --- a/linux/avr32/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, avr32_regs.pc); diff --git a/linux/bfin/arch_regs.c b/linux/bfin/arch_regs.c index f6f42045..e1aa15e4 100644 --- a/linux/bfin/arch_regs.c +++ b/linux/bfin/arch_regs.c @@ -1 +1,2 @@ static long bfin_r0; +#define ARCH_PC_PEEK_ADDR PT_PC diff --git a/linux/bfin/print_pc.c b/linux/bfin/print_pc.c deleted file mode 100644 index b1eef145..00000000 --- a/linux/bfin/print_pc.c +++ /dev/null @@ -1,6 +0,0 @@ -long pc; -if (upeek(tcp->pid, PT_PC, &pc) < 0) { - PRINTBADPC; - return; -} -tprintf(fmt, pc); diff --git a/linux/crisv10/arch_regs.c b/linux/crisv10/arch_regs.c index 573f5932..8f69b873 100644 --- a/linux/crisv10/arch_regs.c +++ b/linux/crisv10/arch_regs.c @@ -1 +1,2 @@ static long cris_r10; +#define ARCH_PC_PEEK_ADDR (4 * PT_IRP) diff --git a/linux/crisv10/print_pc.c b/linux/crisv10/print_pc.c deleted file mode 100644 index cc76216e..00000000 --- a/linux/crisv10/print_pc.c +++ /dev/null @@ -1,6 +0,0 @@ -long pc; -if (upeek(tcp->pid, 4*PT_IRP, &pc) < 0) { - PRINTBADPC; - return; -} -tprintf(fmt, pc); diff --git a/linux/crisv32/arch_regs.c b/linux/crisv32/arch_regs.c index a088e172..8e59c156 100644 --- a/linux/crisv32/arch_regs.c +++ b/linux/crisv32/arch_regs.c @@ -1 +1,2 @@ #include "crisv10/arch_regs.c" +#define ARCH_PC_PEEK_ADDR (4 * PT_ERP) diff --git a/linux/crisv32/print_pc.c b/linux/crisv32/print_pc.c deleted file mode 100644 index b4af6927..00000000 --- a/linux/crisv32/print_pc.c +++ /dev/null @@ -1,6 +0,0 @@ -long pc; -if (upeek(tcp->pid, 4*PT_ERP, &pc) < 0) { - PRINTBADPC; - return; -} -tprintf(fmt, pc); diff --git a/linux/hppa/arch_regs.c b/linux/hppa/arch_regs.c index 56d1ee36..65432abb 100644 --- a/linux/hppa/arch_regs.c +++ b/linux/hppa/arch_regs.c @@ -1 +1,2 @@ static long hppa_r28; +#define ARCH_PC_PEEK_ADDR PT_IAOQ0 diff --git a/linux/hppa/print_pc.c b/linux/hppa/print_pc.c deleted file mode 100644 index 76563464..00000000 --- a/linux/hppa/print_pc.c +++ /dev/null @@ -1,6 +0,0 @@ -long pc; -if (upeek(tcp->pid, PT_IAOQ0, &pc) < 0) { - PRINTBADPC; - return; -} -tprintf(fmt, pc); diff --git a/linux/i386/arch_regs.c b/linux/i386/arch_regs.c index 15b56158..ef300465 100644 --- a/linux/i386/arch_regs.c +++ b/linux/i386/arch_regs.c @@ -2,3 +2,4 @@ static struct user_regs_struct i386_regs; long *const i386_esp_ptr = &i386_regs.esp; #define ARCH_REGS_FOR_GETREGS i386_regs +#define ARCH_PC_REG i386_regs.eip diff --git a/linux/i386/print_pc.c b/linux/i386/print_pc.c deleted file mode 100644 index 0d5c9575..00000000 --- a/linux/i386/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, i386_regs.eip); diff --git a/linux/ia64/arch_regs.c b/linux/ia64/arch_regs.c index d7de2018..14fffd5c 100644 --- a/linux/ia64/arch_regs.c +++ b/linux/ia64/arch_regs.c @@ -5,3 +5,4 @@ unsigned long *const ia64_frame_ptr = &ia64_regs.gr[12]; #define ia64_ia32mode (ia64_regs.cr_ipsr & IA64_PSR_IS) #define ARCH_REGS_FOR_GETREGS ia64_regs +#define ARCH_PC_REG ia64_regs.br[0] diff --git a/linux/ia64/print_pc.c b/linux/ia64/print_pc.c deleted file mode 100644 index fe967809..00000000 --- a/linux/ia64/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, ia64_regs.br[0]); diff --git a/linux/m68k/arch_regs.c b/linux/m68k/arch_regs.c index 5d418251..8f0ab79a 100644 --- a/linux/m68k/arch_regs.c +++ b/linux/m68k/arch_regs.c @@ -1 +1,2 @@ static long m68k_d0; +#define ARCH_PC_PEEK_ADDR (4 * PT_PC) diff --git a/linux/m68k/print_pc.c b/linux/m68k/print_pc.c deleted file mode 100644 index aa4497d5..00000000 --- a/linux/m68k/print_pc.c +++ /dev/null @@ -1,6 +0,0 @@ -long pc; -if (upeek(tcp->pid, 4*PT_PC, &pc) < 0) { - PRINTBADPC; - return; -} -tprintf(fmt, pc); diff --git a/linux/metag/arch_regs.c b/linux/metag/arch_regs.c index b7923bab..e9f0d78a 100644 --- a/linux/metag/arch_regs.c +++ b/linux/metag/arch_regs.c @@ -1,2 +1,3 @@ static struct user_gp_regs metag_regs; #define ARCH_REGS_FOR_GETREGSET metag_regs +#define ARCH_PC_REG metag_regs.pc diff --git a/linux/metag/print_pc.c b/linux/metag/print_pc.c deleted file mode 100644 index 4415f67b..00000000 --- a/linux/metag/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, metag_regs.pc); diff --git a/linux/microblaze/arch_regs.c b/linux/microblaze/arch_regs.c index 9c26aad9..c7bafabd 100644 --- a/linux/microblaze/arch_regs.c +++ b/linux/microblaze/arch_regs.c @@ -1 +1,2 @@ static long microblaze_r3; +#define ARCH_PC_PEEK_ADDR PT_PC diff --git a/linux/microblaze/print_pc.c b/linux/microblaze/print_pc.c deleted file mode 100644 index b1eef145..00000000 --- a/linux/microblaze/print_pc.c +++ /dev/null @@ -1,6 +0,0 @@ -long pc; -if (upeek(tcp->pid, PT_PC, &pc) < 0) { - PRINTBADPC; - return; -} -tprintf(fmt, pc); diff --git a/linux/mips/arch_regs.c b/linux/mips/arch_regs.c index c46e6eba..44f6bd5e 100644 --- a/linux/mips/arch_regs.c +++ b/linux/mips/arch_regs.c @@ -1,3 +1,4 @@ struct mips_regs mips_regs; /* not static */ /* PTRACE_GETREGS on MIPS is available since linux v2.6.15. */ #define ARCH_REGS_FOR_GETREGS mips_regs +#define ARCH_PC_REG mips_REG_EPC diff --git a/linux/mips/print_pc.c b/linux/mips/print_pc.c deleted file mode 100644 index 569b0b6b..00000000 --- a/linux/mips/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, (unsigned long) mips_REG_EPC); diff --git a/linux/nios2/arch_regs.c b/linux/nios2/arch_regs.c index 62827f97..2c30321f 100644 --- a/linux/nios2/arch_regs.c +++ b/linux/nios2/arch_regs.c @@ -1,2 +1,3 @@ static struct user_pt_regs nios2_regs; # define ARCH_REGS_FOR_GETREGSET nios2_regs +#define ARCH_PC_REG nios2_regs.regs[PTR_EA] diff --git a/linux/nios2/print_pc.c b/linux/nios2/print_pc.c deleted file mode 100644 index d22e8f73..00000000 --- a/linux/nios2/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, nios2_regs.regs[PTR_EA]); diff --git a/linux/or1k/arch_regs.c b/linux/or1k/arch_regs.c index 7415e088..78693e5a 100644 --- a/linux/or1k/arch_regs.c +++ b/linux/or1k/arch_regs.c @@ -1,2 +1,3 @@ static struct user_regs_struct or1k_regs; #define ARCH_REGS_FOR_GETREGSET or1k_regs +#define ARCH_PC_REG or1k_regs.pc diff --git a/linux/or1k/print_pc.c b/linux/or1k/print_pc.c deleted file mode 100644 index 3fe4a1a1..00000000 --- a/linux/or1k/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, or1k_regs.pc); diff --git a/linux/powerpc/arch_regs.c b/linux/powerpc/arch_regs.c index cd92d21d..dd573f71 100644 --- a/linux/powerpc/arch_regs.c +++ b/linux/powerpc/arch_regs.c @@ -1,3 +1,4 @@ struct pt_regs ppc_regs; /* not static */ #define ARCH_REGS_FOR_GETREGS ppc_regs +#define ARCH_PC_REG ppc_regs.nip diff --git a/linux/powerpc/print_pc.c b/linux/powerpc/print_pc.c deleted file mode 100644 index 34112fb6..00000000 --- a/linux/powerpc/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, ppc_regs.nip); diff --git a/linux/powerpc64/arch_regs.c b/linux/powerpc64/arch_regs.c index b5c572dc..90646515 100644 --- a/linux/powerpc64/arch_regs.c +++ b/linux/powerpc64/arch_regs.c @@ -1 +1,2 @@ #include "powerpc/arch_regs.c" +#define ARCH_PC_REG ppc_regs.nip diff --git a/linux/powerpc64/print_pc.c b/linux/powerpc64/print_pc.c deleted file mode 100644 index ddaf880b..00000000 --- a/linux/powerpc64/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -#include "powerpc/print_pc.c" diff --git a/linux/s390/arch_regs.c b/linux/s390/arch_regs.c index 32c50a15..fefb7630 100644 --- a/linux/s390/arch_regs.c +++ b/linux/s390/arch_regs.c @@ -2,3 +2,4 @@ static struct user_regs_struct s390_regset; unsigned long *const s390_frame_ptr = &s390_regset.gprs[15]; #define ARCH_REGS_FOR_GETREGSET s390_regset +#define ARCH_PC_REG s390_regset.psw.addr diff --git a/linux/s390/print_pc.c b/linux/s390/print_pc.c deleted file mode 100644 index f92ccd43..00000000 --- a/linux/s390/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, s390_regset.psw.addr); diff --git a/linux/s390x/arch_regs.c b/linux/s390x/arch_regs.c index 62aece72..74aaaf6d 100644 --- a/linux/s390x/arch_regs.c +++ b/linux/s390x/arch_regs.c @@ -1 +1,2 @@ #include "s390/arch_regs.c" +#define ARCH_PC_REG s390_regset.psw.addr diff --git a/linux/s390x/print_pc.c b/linux/s390x/print_pc.c deleted file mode 100644 index 9a445f7d..00000000 --- a/linux/s390x/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -#include "s390/print_pc.c" diff --git a/linux/sh/arch_regs.c b/linux/sh/arch_regs.c index 9d24ee75..0ce81843 100644 --- a/linux/sh/arch_regs.c +++ b/linux/sh/arch_regs.c @@ -1 +1,2 @@ static long sh_r0; +#define ARCH_PC_PEEK_ADDR (4 * REG_PC) diff --git a/linux/sh/print_pc.c b/linux/sh/print_pc.c deleted file mode 100644 index 2f43eff3..00000000 --- a/linux/sh/print_pc.c +++ /dev/null @@ -1,6 +0,0 @@ -long pc; -if (upeek(tcp->pid, 4*REG_PC, &pc) < 0) { - PRINTBADPC; - return; -} -tprintf(fmt, pc); diff --git a/linux/sh64/arch_regs.c b/linux/sh64/arch_regs.c index e09cac5a..eb6701b9 100644 --- a/linux/sh64/arch_regs.c +++ b/linux/sh64/arch_regs.c @@ -1 +1,2 @@ static long sh64_r9; +#define ARCH_PC_PEEK_ADDR REG_PC diff --git a/linux/sh64/print_pc.c b/linux/sh64/print_pc.c deleted file mode 100644 index c0232e55..00000000 --- a/linux/sh64/print_pc.c +++ /dev/null @@ -1,6 +0,0 @@ -long pc; -if (upeek(tcp->pid, REG_PC, &pc) < 0) { - PRINTBADPC; - return; -} -tprintf(fmt, pc); diff --git a/linux/sparc/arch_regs.c b/linux/sparc/arch_regs.c index ed13029e..c0f22e6c 100644 --- a/linux/sparc/arch_regs.c +++ b/linux/sparc/arch_regs.c @@ -1,2 +1,3 @@ struct pt_regs sparc_regs; /* not static */ #define ARCH_REGS_FOR_GETREGS sparc_regs +#define ARCH_PC_REG sparc_regs.pc diff --git a/linux/sparc/print_pc.c b/linux/sparc/print_pc.c deleted file mode 100644 index 683e3b17..00000000 --- a/linux/sparc/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, sparc_regs.pc); diff --git a/linux/sparc64/arch_regs.c b/linux/sparc64/arch_regs.c index db38d886..072a3553 100644 --- a/linux/sparc64/arch_regs.c +++ b/linux/sparc64/arch_regs.c @@ -1 +1,2 @@ #include "sparc/arch_regs.c" +#define ARCH_PC_REG sparc_regs.tpc diff --git a/linux/sparc64/print_pc.c b/linux/sparc64/print_pc.c deleted file mode 100644 index 11c0ac43..00000000 --- a/linux/sparc64/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, sparc_regs.tpc); diff --git a/linux/tile/arch_regs.c b/linux/tile/arch_regs.c index 455077c5..6a7309d2 100644 --- a/linux/tile/arch_regs.c +++ b/linux/tile/arch_regs.c @@ -1,2 +1,3 @@ struct pt_regs tile_regs; /* not static */ #define ARCH_REGS_FOR_GETREGS tile_regs +#define ARCH_PC_REG tile_regs.pc diff --git a/linux/tile/print_pc.c b/linux/tile/print_pc.c deleted file mode 100644 index 8a6894f5..00000000 --- a/linux/tile/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -tprintf(fmt, (unsigned long) tile_regs.pc); diff --git a/linux/x32/arch_regs.c b/linux/x32/arch_regs.c index 62c70be8..8140bc09 100644 --- a/linux/x32/arch_regs.c +++ b/linux/x32/arch_regs.c @@ -1 +1,2 @@ #include "x86_64/arch_regs.c" +#define ARCH_PC_REG (x86_io.iov_len == sizeof(i386_regs) ? i386_regs.eip : x86_64_regs.rip) diff --git a/linux/x32/print_pc.c b/linux/x32/print_pc.c deleted file mode 100644 index 13ccdc2e..00000000 --- a/linux/x32/print_pc.c +++ /dev/null @@ -1 +0,0 @@ -#include "x86_64/print_pc.c" diff --git a/linux/x86_64/arch_regs.c b/linux/x86_64/arch_regs.c index 1925dadb..daee69f9 100644 --- a/linux/x86_64/arch_regs.c +++ b/linux/x86_64/arch_regs.c @@ -38,3 +38,4 @@ static struct iovec x86_io = { #define ARCH_REGS_FOR_GETREGSET x86_regs_union #define ARCH_IOVEC_FOR_GETREGSET x86_io +#define ARCH_PC_REG (x86_io.iov_len == sizeof(i386_regs) ? i386_regs.eip : x86_64_regs.rip) diff --git a/linux/x86_64/print_pc.c b/linux/x86_64/print_pc.c deleted file mode 100644 index 71b080ad..00000000 --- a/linux/x86_64/print_pc.c +++ /dev/null @@ -1,4 +0,0 @@ -if (x86_io.iov_len == sizeof(i386_regs)) - tprintf(fmt, (unsigned long) i386_regs.eip); -else - tprintf(fmt, (unsigned long) x86_64_regs.rip); diff --git a/linux/xtensa/arch_regs.c b/linux/xtensa/arch_regs.c index 1114cabe..d36f56a0 100644 --- a/linux/xtensa/arch_regs.c +++ b/linux/xtensa/arch_regs.c @@ -1 +1,2 @@ static long xtensa_a2; +#define ARCH_PC_PEEK_ADDR REG_PC diff --git a/linux/xtensa/print_pc.c b/linux/xtensa/print_pc.c deleted file mode 100644 index c0232e55..00000000 --- a/linux/xtensa/print_pc.c +++ /dev/null @@ -1,6 +0,0 @@ -long pc; -if (upeek(tcp->pid, REG_PC, &pc) < 0) { - PRINTBADPC; - return; -} -tprintf(fmt, pc); diff --git a/syscall.c b/syscall.c index 3f43a57d..99bc731f 100644 --- a/syscall.c +++ b/syscall.c @@ -1197,32 +1197,21 @@ is_negated_errno(kernel_ulong_t val) void print_pc(struct tcb *tcp) { - const char *fmt; - const char *bad; - -#ifdef current_wordsize -# define pc_wordsize current_wordsize +#if defined ARCH_PC_REG +# define ARCH_GET_PC 0 +#elif defined ARCH_PC_PEEK_ADDR + long pc; +# define ARCH_PC_REG pc +# define ARCH_GET_PC upeek(tcp->pid, ARCH_PC_PEEK_ADDR, &pc) #else -# define pc_wordsize personality_wordsize[tcp->currpers] +# error Neither ARCH_PC_REG nor ARCH_PC_PEEK_ADDR is defined #endif - - if (pc_wordsize == 4) { - fmt = "[%08lx] "; - bad = "[????????] "; - } else { - fmt = "[%016lx] "; - bad = "[????????????????] "; - } - -#undef pc_wordsize -#define PRINTBADPC tprints(bad) - - if (get_regs_error) { - PRINTBADPC; - return; - } - -#include "print_pc.c" + if (get_regs_error || ARCH_GET_PC) + tprints(current_wordsize == 4 ? "[????????] " + : "[????????????????] "); + else + tprintf(current_wordsize == 4 ? "[%08lx] " : "[%016lx] ", + (unsigned long) ARCH_PC_REG); } #if defined X86_64 || defined POWERPC