This is the mail archive of the
mailing list for the GDB project.
Re: GDB hangs with simple multi-threaded program on linux
On Thu, 2010-07-15 at 12:44 -0600, Tom Tromey wrote:
> >>>>> "Thiago" == Thiago Jung Bauermann <email@example.com> 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.
Thanks for looking into 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 :-)
I will play with that option and see what happens...
Thanks for sending the patch. It is racy but at least makes an effort to
avoid the trap, which is an improvement. :-)
> 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.
Ouch. Looks like we have our hands tied here. :-/
> BTW, if you plan to work on this, it is also PR 10970.
I do, and will update the PR accordingly. Thanks!
Thiago Jung Bauermann
IBM Linux Technology Center