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.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6535030..f634583 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -56,6 +56,8 @@
_newselect \
adjtimex \
aio \
+ attach-p-cmd-cmd \
+ attach-p-cmd-p \
bpf \
caps \
clock_nanosleep \
@@ -299,6 +301,7 @@
xettimeofday.test \
\
count.test \
+ attach-p-cmd.test \
detach-sleeping.test \
detach-stopped.test \
detach-running.test \