Add capability for Linux to change a vfork call into plain fork, which

can be followed.  (Requires a kernel patch for now.)  Also document it.
This commit is contained in:
Nate Sammons 1999-03-29 22:57:54 +00:00
parent 39c761997d
commit ccd8f21626
2 changed files with 18 additions and 6 deletions

View File

@ -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;

View File

@ -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