I have some difficulty understanding the -D option of strace. strace manpage says

-D Run tracer process as a detached grandchild, not as parent of the tracee. This reduces the visible effect of strace by keeping the tracee a direct child of the calling process.

Is "tracer process" the process which runs strace?

Is "calling process" the parent process of the "tracer process"?

What are the parent-child relations between the tracer, tracee and calling processes, without -D and with -D?


1 Answer 1


The tracer process is the process which runs strace, yes. The calling process is the process which starts strace, so typically your shell.

Without -D, the traced process’ parent ends up being strace:

strace sleep 120

shows up in pstree as


With -D, strace detaches itself and ends up being re-parented, on my system to my user systemd process:

    |         |-gnome-terminal--+-3*[zsh]
    |         |                 |-zsh---sleep
    |         |-strace

The impact of the -D option is briefly described in the strace man page:

Note that parent-child relationship (signal stop notifications, getppid() value, etc) between traced process and its parent are not preserved unless -D is used.

Running with -D means that the child will find its expected parent when it calls getppid(), and it also makes SIGCHLD behave correctly when the child is stopped and continued. This can be important in circumstances where you insert strace between a process and its children, when its children need to find their parent.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .