GDB hangs with simple multi-threaded program on linux

Tom Tromey
Thu Jul 15 18:44:00 GMT 2010

>>>>> "Thiago" == Thiago Jung Bauermann <> writes:

Thiago> I'm struggling with an issue which perhaps you already faced or
Thiago> thought about...

I asked around about this, and it turns out that we have a patch in the
Fedora SRPM for it.

The approach in this patch seems to be racy.  Roland says we can do
better if we enable exit tracing.  I see this in linux-nat.c:

  /* Do not enable PTRACE_O_TRACEEXIT until GDB is more prepared to support
     read-only process state.  */

I wonder what that means :-)

Thiago> 1. Is it true that when the main thread exits but there are other
Thiago> threads in the thread group, then no SIGCHLD is generated to notify GDB
Thiago> that it exited (perhaps because such a SIGCHLD could be ambiguous and
Thiago> mean that the whole process exited)?

Yes, Roland said that no SIGCHLD is generated.

Thiago> 2. Is there a way for GDB to wait on just the main thread instead of on
Thiago> the whole process when it waits on a TID which is also the PID?

I guess not.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb-6.6-bz247354-leader-exit-fix.patch
Type: text/x-patch
Size: 4755 bytes
Desc: leader-exit-fix.patch
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb-6.6-bz247354-leader-exit-test.patch
Type: text/x-patch
Size: 3546 bytes
Desc: leader-exit-test.patch
URL: <>

More information about the Gdb mailing list