I'm trying to debug a process that forks when processing a request.
I've set follow-fork-mode to child allow gdb to break in when hitting a breakpoint in a child. However, when I continue from the child, the parent detaches.
Lots of doc points to the option detach-on-fork, but if I try to set this option, I get:
(gdb) set detach-on-fork on
No symbol "detach" in current context.
The option is clearly linked from: http://sourceware.org/gdb/onlinedocs/gdb/Forks.html
Edit: system information
>uname -a
Linux localhost 2.6.9-78.0.22.ELsmp #1 SMP Thu Apr 30 19:14:39 EDT 2009 i686 i686 i386 GNU/Linux
>gdb -v
GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
Edit #2:
$ gdb -v
GNU gdb Red Hat Linux (6.5-16.el5rh)
(gdb) show detach-on-fork
Whether gdb will detach the child of a fork is on.
I guess it was added sometime between 6.3 and 6.5. I didn't realize this box had such an old version of gdb. Thanks!
If anyone who commented wants to add an answer, I'll accept it!
The detach-on-fork option was added in GDB 6.5. At the time it only worked on Linux; not sure if additional OS support has been added since then.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With