From: Dmitry V. Levin Date: Mon, 18 Mar 2013 00:52:29 +0000 (+0000) Subject: ptrace: decode note segment descriptor types X-Git-Tag: v4.8~94 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c41808bcd6c311391ab6b40880aa428d4730f0a4;p=strace ptrace: decode note segment descriptor types * configure.ac (AC_CHECK_HEADERS): Add elf.h. * process.c: Include elf.h. (nt_descriptor_types): New xlat structure. (sys_ptrace): Use it. --- diff --git a/configure.ac b/configure.ac index 09056a5a..998324d2 100644 --- a/configure.ac +++ b/configure.ac @@ -201,6 +201,7 @@ AC_CHECK_FUNCS(m4_normalize([ AC_CHECK_HEADERS(m4_normalize([ asm/cachectl.h asm/sysmips.h + elf.h inttypes.h ioctls.h libaio.h diff --git a/process.c b/process.c index 617b78df..9bc78d6c 100644 --- a/process.c +++ b/process.c @@ -41,6 +41,9 @@ #include #include #include +#ifdef HAVE_ELF_H +# include +#endif #ifdef HAVE_SYS_REG_H # include @@ -1278,6 +1281,79 @@ static const struct xlat ptrace_setoptions_flags[] = { }; #endif /* PTRACE_SETOPTIONS */ +static const struct xlat nt_descriptor_types[] = { +#ifdef NT_PRSTATUS + { NT_PRSTATUS, "NT_PRSTATUS" }, +#endif +#ifdef NT_FPREGSET + { NT_FPREGSET, "NT_FPREGSET" }, +#endif +#ifdef NT_PRPSINFO + { NT_PRPSINFO, "NT_PRPSINFO" }, +#endif +#ifdef NT_PRXREG + { NT_PRXREG, "NT_PRXREG" }, +#endif +#ifdef NT_TASKSTRUCT + { NT_TASKSTRUCT, "NT_TASKSTRUCT" }, +#endif +#ifdef NT_PLATFORM + { NT_PLATFORM, "NT_PLATFORM" }, +#endif +#ifdef NT_AUXV + { NT_AUXV, "NT_AUXV" }, +#endif +#ifdef NT_GWINDOWS + { NT_GWINDOWS, "NT_GWINDOWS" }, +#endif +#ifdef NT_ASRS + { NT_ASRS, "NT_ASRS" }, +#endif +#ifdef NT_PSTATUS + { NT_PSTATUS, "NT_PSTATUS" }, +#endif +#ifdef NT_PSINFO + { NT_PSINFO, "NT_PSINFO" }, +#endif +#ifdef NT_PRCRED + { NT_PRCRED, "NT_PRCRED" }, +#endif +#ifdef NT_UTSNAME + { NT_UTSNAME, "NT_UTSNAME" }, +#endif +#ifdef NT_LWPSTATUS + { NT_LWPSTATUS, "NT_LWPSTATUS" }, +#endif +#ifdef NT_LWPSINFO + { NT_LWPSINFO, "NT_LWPSINFO" }, +#endif +#ifdef NT_PRFPXREG + { NT_PRFPXREG, "NT_PRFPXREG" }, +#endif +#ifdef NT_PRXFPREG + { NT_PRXFPREG, "NT_PRXFPREG" }, +#endif +#ifdef NT_PPC_VMX + { NT_PPC_VMX, "NT_PPC_VMX" }, +#endif +#ifdef NT_PPC_SPE + { NT_PPC_SPE, "NT_PPC_SPE" }, +#endif +#ifdef NT_PPC_VSX + { NT_PPC_VSX, "NT_PPC_VSX" }, +#endif +#ifdef NT_386_TLS + { NT_386_TLS, "NT_386_TLS" }, +#endif +#ifdef NT_386_IOPERM + { NT_386_IOPERM, "NT_386_IOPERM" }, +#endif +#ifdef NT_X86_XSTATE + { NT_X86_XSTATE, "NT_X86_XSTATE" }, +#endif + { 0, NULL }, +}; + #define uoff(member) offsetof(struct user, member) const struct xlat struct_user_offsets[] = { @@ -2311,9 +2387,12 @@ sys_ptrace(struct tcb *tcp) tprintf("%s, ", x->str); } else #ifdef PTRACE_GETREGSET - //if (tcp->u_arg[0] == PTRACE_GET/SETREGSET) { - // TODO: show tcp->u_arg[2] as "NT_xxx, " - //} else + if (tcp->u_arg[0] == PTRACE_GETREGSET + || tcp->u_arg[0] == PTRACE_SETREGSET + ) { + printxval(nt_descriptor_types, tcp->u_arg[2], "NT_???"); + tprints(", "); + } else #endif tprintf("%#lx, ", addr);