strace changes behavior of the traced process
Andreas Schwab
schwab at linux-m68k.org
Mon Jul 28 17:00:53 UTC 2014
Yuri <yuri-WD5pMP1oN6wAvxtiuMwx3w at public.gmane.org> writes:
> When I run 'gdb printf' with and without strace, the output of gdb is
> different in that with strace "Inferior exited" message disappears.
> It looks like strace maybe consumes the exit signal of the debugged
> process before gdb does?
>
> $ gdb printf
> <...skipped...>
> (gdb) r "Hello\n"
> Starting program: /usr/bin/printf "Hello\n"
> Hello
> [Inferior 1 (process 3057) exited normally]
> (gdb)
>
>
> $ strace -f 2>/dev/null gdb printf
> <...skipped...>
> (gdb) r "Hello\n"
> Starting program: /usr/bin/printf "Hello\n"
> Hello
> (gdb)
That's because gdb never gets a chance to trace the inferior (there can
be only one tracer). A newer gdb complains that the program exited
during startup.
Andreas.
--
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Strace-devel
mailing list