Make struct used by PTRACE_GETREGS arch-dependant
Structure used by ptrace in PTRACE_GETREGS mode is unfortunetely arch-dependant. Although pt_regs seems portable, it's only designed to represent the way registers are stored on the stack during system call. The right struct to use is defined in sys/user.h and is user_regs_struct on x86-{32,64} and user_regs on armel.
This commit is contained in:
parent
1cede92011
commit
a8f2e34c5f
4
pstack.c
4
pstack.c
|
@ -114,12 +114,14 @@
|
|||
#endif /* x86-{32,64} */
|
||||
#define NEXT_FRAME_POINTER_ADDR(fp) (fp)
|
||||
#define NEXT_PROGRAM_COUNTER_ADDR(fp) ((fp) + __SIZEOF_POINTER__)
|
||||
#define DECLARE_REGS_STRUCT(regs) struct user_regs_struct regs
|
||||
#elif defined(__ARMEL__) /* armel */
|
||||
#define ELF_MACHINE EM_ARM
|
||||
#define PROGRAM_COUNTER(regs) (regs.ARM_pc)
|
||||
#define FRAME_POINTER(regs) (regs.ARM_fp)
|
||||
#define NEXT_FRAME_POINTER_ADDR(fp) ((fp) - __SIZEOF_POINTER__)
|
||||
#define NEXT_PROGRAM_COUNTER_ADDR(fp) (fp)
|
||||
#define DECLARE_REGS_STRUCT(regs) struct user_regs regs
|
||||
#elif defined(__ppc64__) || defined(__alpha__) || defined(__ia64__) || defined(s390x__)
|
||||
#error Not (yet) supported architecture, patches welcomes :-)
|
||||
#else
|
||||
|
@ -643,7 +645,7 @@ static int crawl(int pid)
|
|||
{
|
||||
unsigned long pc, fp, nextfp, nargs, i, arg;
|
||||
int ret, error_occured = 0;
|
||||
struct pt_regs regs;
|
||||
DECLARE_REGS_STRUCT(regs);
|
||||
|
||||
errno = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue