]> granicus.if.org Git - strace/commit
Implement simultaneous use of -p option and tracing of a command
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 22 Jan 2016 14:37:14 +0000 (14:37 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 22 Jan 2016 19:37:11 +0000 (19:37 +0000)
commitfa8c286d50d83ae86d2ca8df52f7aba8b6c5bae1
tree3f93a78249c4784d0f6ae4e7c6cf36781b8569ee
parent38721432de0e43adcd0ebdb9794e151fe0ce5168
Implement simultaneous use of -p option and tracing of a command

* strace.c (init): Allow -p option along with a command.
(startup_child): In -D mode, record the parent of the tracer process
as strace_child.
(startup_attach): Save trace_tracer_pid before -D mode fork.
When tracing a command in -f mode, do not check for the command's
threads as it has no threads at this moment.
Never attach to the tracer process.
In -D mode, never attach to the parent of the tracer process,
terminate that process only once at the end of startup_attach,
and reset strace_child.
* strace.1: Document that -p option can be used along with tracing
of a command.
* NEWS: Mention it.
* tests/attach-p-cmd-cmd.c: New file.
* tests/attach-p-cmd-p.c: Likewise.
* tests/attach-p-cmd.test: New test.
* tests/.gitignore: Add attach-p-cmd-cmd and attach-p-cmd-p.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add attach-p-cmd.test.

This fixes Debian bug #549942.
NEWS
strace.1
strace.c
tests/.gitignore
tests/Makefile.am
tests/attach-p-cmd-cmd.c [new file with mode: 0644]
tests/attach-p-cmd-p.c [new file with mode: 0644]
tests/attach-p-cmd.test [new file with mode: 0755]