]> granicus.if.org Git - strace/commitdiff
Add capability for Linux to change a vfork call into plain fork, which
authorNate Sammons <nate@users.sourceforge.net>
Mon, 29 Mar 1999 22:57:54 +0000 (22:57 +0000)
committerNate Sammons <nate@users.sourceforge.net>
Mon, 29 Mar 1999 22:57:54 +0000 (22:57 +0000)
can be followed.  (Requires a kernel patch for now.)  Also document it.

process.c
strace.1

index 5fc7744fee71f585b1e8fc8a3b69a4838accd568..5ecaa16c71b77b82a19a07729b12e9103dc6ee10 100644 (file)
--- a/process.c
+++ b/process.c
@@ -285,13 +285,24 @@ struct tcb *tcp;
 {
        struct tcb *tcpchild;
        int pid;
-       int vforking = 0;
+       int dont_follow = 0;
 
 #ifdef SYS_vfork
-       vforking = (tcp->scno == SYS_vfork);
+       if (tcp->scno == SYS_vfork) {
+#if defined(I386) && defined(LINUX)
+               /* Attempt to make vfork into fork, which we can follow. */
+               if (!followvfork || 
+                   ptrace(PTRACE_POKEUSR, tcp->pid, 
+                          (void *)(ORIG_EAX * 4), SYS_fork) < 0) 
+                       dont_follow = 1;
+               
+#else
+               dont_follow = 1;
+#endif
+       }
 #endif
        if (entering(tcp)) {
-               if (!followfork || vforking)
+               if (!followfork || dont_follow)
                        return 0;
                if (nprocs == MAX_PROCS) {
                        tcp->flags &= ~TCB_FOLLOWFORK;
index 5f045f9667bad2fc045ffd293d337477c99a2add..56e02da36bec3f7ca4f641add3afc0787aeeb403 100644 (file)
--- a/strace.1
+++ b/strace.1
@@ -236,9 +236,10 @@ option is in effect, each processes trace is written to
 where pid is the numeric process id of each process.
 .TP
 .B \-F
-On SunOS 4.x, this option has the effect of attempting to follow
-vforks by performing some dynamic linking trickery.  Otherwise,
-vforks will not be followed even if
+Attempt to follow vforks.  (On SunOS 4.x, this is accomplished with
+some dynamic linking trickery.  On Linux, it requires some kernel
+functionality not yet in the standard kernel.)  Otherwise, vforks will
+not be followed even if
 .B \-f
 has been given.
 .TP