If we use -D and -p option together to trace a multi-thread program, in
addtion to the main thread, other threads could not be traced even if we
present -f option. Moreover, when executing 'strace -D -p <non-exist pid>',
strace could not terminate normally.

* strace.c (main): Check it.

Signed-off-by: Wang Chao <[email protected]>
---
 strace.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/strace.c b/strace.c
index 21febb3..3505948 100644
--- a/strace.c
+++ b/strace.c
@@ -846,6 +846,13 @@ main(int argc, char *argv[])
        if ((optind == argc) == !pflag_seen)
                usage(stderr, 1);
 
+       if (pflag_seen && daemonized_tracer) {
+               fprintf(stderr,
+                       "%s: -D and -p are mutually exclusive options\n",
+                       progname);
+               exit(1);
+       }
+
        if (!followfork)
                followfork = optF;
 
-- 
1.6.5.2


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to