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:
parent
39c761997d
commit
ccd8f21626
17
process.c
17
process.c
@ -285,13 +285,24 @@ struct tcb *tcp;
|
|||||||
{
|
{
|
||||||
struct tcb *tcpchild;
|
struct tcb *tcpchild;
|
||||||
int pid;
|
int pid;
|
||||||
int vforking = 0;
|
int dont_follow = 0;
|
||||||
|
|
||||||
#ifdef SYS_vfork
|
#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
|
#endif
|
||||||
if (entering(tcp)) {
|
if (entering(tcp)) {
|
||||||
if (!followfork || vforking)
|
if (!followfork || dont_follow)
|
||||||
return 0;
|
return 0;
|
||||||
if (nprocs == MAX_PROCS) {
|
if (nprocs == MAX_PROCS) {
|
||||||
tcp->flags &= ~TCB_FOLLOWFORK;
|
tcp->flags &= ~TCB_FOLLOWFORK;
|
||||||
|
7
strace.1
7
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.
|
where pid is the numeric process id of each process.
|
||||||
.TP
|
.TP
|
||||||
.B \-F
|
.B \-F
|
||||||
On SunOS 4.x, this option has the effect of attempting to follow
|
Attempt to follow vforks. (On SunOS 4.x, this is accomplished with
|
||||||
vforks by performing some dynamic linking trickery. Otherwise,
|
some dynamic linking trickery. On Linux, it requires some kernel
|
||||||
vforks will not be followed even if
|
functionality not yet in the standard kernel.) Otherwise, vforks will
|
||||||
|
not be followed even if
|
||||||
.B \-f
|
.B \-f
|
||||||
has been given.
|
has been given.
|
||||||
.TP
|
.TP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user