]> granicus.if.org Git - strace/commitdiff
2005-06-06 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Tue, 7 Jun 2005 23:21:31 +0000 (23:21 +0000)
committerRoland McGrath <roland@redhat.com>
Tue, 7 Jun 2005 23:21:31 +0000 (23:21 +0000)
* defs.h (struct sysent): New member `native_scno'.
(known_scno): Declare new function.
* linux/syscallent.h: Add new final field to interesting syscalls.
* syscall.c (known_scno): New function.
(dumpio, internal_syscall, syscall_fixup, trace_syscall): Use it.
* process.c (internal_fork, internal_exit): Likewise.
[IA64] (ARG_STACKSIZE, ARG_PTID, ARG_CTID, ARG_TLS): Likewise.
* strace.c (proc_open): Likewise.
* util.c [LINUX] (setbpt): Likewise.
* linux/syscall.h: Remove [!defined(X86_64)] from conditional
for defining SYS_socket_subcall et al.
* linux/syscallent.h: Likewise for #error check.
* syscall.c (trace_syscall): Likewise for SYS_{socketcall,ipc} cases.
Fixes RH#158934.

defs.h
strace.c
util.c

diff --git a/defs.h b/defs.h
index e32e3ed9fb35098ff95a1573d6bb8eba3881e865..24cf19cd17f939d9807794e053f5aedaba572210 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -424,6 +424,7 @@ extern void set_overhead P((int));
 extern void qualify P((char *));
 extern void newoutf P((struct tcb *));
 extern int get_scno P((struct tcb *));
+extern long known_scno P((struct tcb *));
 extern int trace_syscall P((struct tcb *));
 extern void printxval P((const struct xlat *, int, const char *));
 extern int printargs P((struct tcb *));
@@ -526,6 +527,7 @@ struct sysent {
        int     sys_flags;
        int     (*sys_func)();
        const char *sys_name;
+       long    native_scno;    /* Match against SYS_* constants.  */
 };
 
 extern const struct sysent *sysent;
index 12f1fc79aee16debce417a1236a3d65573da138f..f028de39288f6094541fd4d0794a4d36f9a6768d 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -1002,7 +1002,7 @@ int attaching;
                        if (tcp->status.PR_WHY == PR_SYSENTRY) {
                                tcp->flags &= ~TCB_INSYSCALL;
                                get_scno(tcp);
-                               if (tcp->scno == SYS_execve)
+                               if (known_scno(tcp) == SYS_execve)
                                        break;
                        }
                        /* Set it running: maybe execve will be next. */
diff --git a/util.c b/util.c
index e477cf10e9ac0f52f894e866b20867d9f6a7aadc..4f2dd5e46c69110c3d6f767a6cae3772d41a3a5a 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1205,6 +1205,9 @@ struct tcb *tcp;
 #ifndef CLONE_PTRACE
 # define CLONE_PTRACE    0x00002000
 #endif
+#ifndef CLONE_STOPPED
+# define CLONE_STOPPED   0x02000000
+#endif
 
 #ifdef IA64
 
@@ -1369,7 +1372,16 @@ typedef int arg_setup_state;
 static int
 set_arg0 (struct tcb *tcp, void *cookie, long val)
 {
-       return ptrace (PTRACE_POKEUSER, tcp->pid, (char*)arg0_offset, val);
+       long oldval,newval;
+       if (get_arg0(tcp, cookie, &oldval) < 0)
+               abort ();
+       if (ptrace (PTRACE_POKEUSER, tcp->pid, (char*)arg0_offset, val) < 0)
+               return -1;
+       if (get_arg0(tcp, cookie, &newval) < 0)
+               abort ();
+       fprintf(stderr, "XXX old %lx set %lx new %lx\n",
+               oldval,val,newval);
+       return 0;
 }
 
 static int
@@ -1404,7 +1416,7 @@ struct tcb *tcp;
                return -1;
        }
 
-       switch (tcp->scno) {
+       switch (known_scno(tcp)) {
 #ifdef SYS_vfork
        case SYS_vfork:
 #endif