]> granicus.if.org Git - strace/commitdiff
2003-01-14 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Tue, 14 Jan 2003 09:46:21 +0000 (09:46 +0000)
committerRoland McGrath <roland@redhat.com>
Tue, 14 Jan 2003 09:46:21 +0000 (09:46 +0000)
* process.c: Use <linux/ptrace.h> regardless of <sys/reg.h>.
(sys_ptrace): Use printxval.
(ptrace_cmds): Make PTRACE_GETREGS et al conditional on #ifdef PTRACE_*
instead of only #ifdef SUNOS4.  Add PTRACE_[GS]ETFPXREGS.

process.c

index 965822ca0e5f3786e1fca8c93381f2c607db4575..c66e7c2ff2950f5c6d39b2aa312f59f9b6133ea9 100644 (file)
--- a/process.c
+++ b/process.c
 #endif
 #endif /* HAVE_ASM_REG_H */
 
+#ifdef HAVE_LINUX_PTRACE_H
+#undef PTRACE_SYSCALL
+#include <linux/ptrace.h>
+#endif
+
 #ifdef HAVE_SYS_REG_H
 # include <sys/reg.h>
 #ifndef PTRACE_PEEKUSR
@@ -78,9 +83,6 @@
 #ifndef PTRACE_POKEUSR
 # define PTRACE_POKEUSR PTRACE_POKEUSER
 #endif
-#elif defined(HAVE_LINUX_PTRACE_H)
-#undef PTRACE_SYSCALL
-#include <linux/ptrace.h>
 #endif
 
 #ifdef HAVE_LINUX_FUTEX_H
@@ -1945,11 +1947,25 @@ static struct xlat ptrace_cmds[] = {
        { PTRACE_SINGLESTEP,    "PTRACE_SINGLESTEP"     },
        { PTRACE_ATTACH,        "PTRACE_ATTACH"         },
        { PTRACE_DETACH,        "PTRACE_DETACH"         },
-#ifdef SUNOS4
+#ifdef PTRACE_GETREGS
        { PTRACE_GETREGS,       "PTRACE_GETREGS"        },
+#endif
+#ifdef PTRACE_SETREGS
        { PTRACE_SETREGS,       "PTRACE_SETREGS"        },
+#endif
+#ifdef PTRACE_GETFPREGS
        { PTRACE_GETFPREGS,     "PTRACE_GETFPREGS",     },
+#endif
+#ifdef PTRACE_SETFPREGS
        { PTRACE_SETFPREGS,     "PTRACE_SETFPREGS",     },
+#endif
+#ifdef PTRACE_GETFPXREGS
+       { PTRACE_GETFPXREGS,    "PTRACE_GETFPXREGS",    },
+#endif
+#ifdef PTRACE_SETFPXREGS
+       { PTRACE_SETFPXREGS,    "PTRACE_SETFPXREGS",    },
+#endif
+#ifdef SUNOS4
        { PTRACE_READDATA,      "PTRACE_READDATA"       },
        { PTRACE_WRITEDATA,     "PTRACE_WRITEDATA"      },
        { PTRACE_READTEXT,      "PTRACE_READTEXT"       },
@@ -2500,19 +2516,18 @@ int
 sys_ptrace(tcp)
 struct tcb *tcp;
 {
-       char *cmd;
        struct xlat *x;
        long addr;
 
-       cmd = xlookup(ptrace_cmds, tcp->u_arg[0]);
-       if (!cmd)
+       if (entering(tcp)) {
+               printxval(ptrace_cmds, tcp->u_arg[0],
 #ifndef FREEBSD
-               cmd = "PTRACE_???";
+                         "PTRACE_???"
 #else
-               cmd = "PT_???";
+                         "PT_???"
 #endif
-       if (entering(tcp)) {
-               tprintf("%s, %lu, ", cmd, tcp->u_arg[1]);
+                       );
+               tprintf(", %lu, ", tcp->u_arg[1]);
                addr = tcp->u_arg[2];
 #ifndef FREEBSD
                if (tcp->u_arg[0] == PTRACE_PEEKUSER