This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Linux threads support in GDB
- To: gdb at dontknow dot org
- Subject: Re: Linux threads support in GDB
- From: Mark Kettenis <kettenis at wins dot uva dot nl>
- Date: Tue, 3 Oct 2000 10:28:49 +0200 (MET DST)
- CC: gdb at sourceware dot cygnus dot com
- References: <200010022259.e92MxmK06653@mbox.wins.uva.nl>
Date: Mon, 02 Oct 2000 17:03:48 -0600 (MDT)
From: gdb@dontknow.org
On 02-Oct-00 Mark Kettenis wrote:
> Date: Wed, 13 Sep 2000 18:25:21 -0600 (MDT)
> From: gdb@dontknow.org
>
> Appologies for the this late reply. Meanwhile, the particular failing
> assertions you were seeing should be gone.
>
> Ok, here is a test case that will reproduce the problem (to some
> extent anyways). I guess for some of my testing trying to reproduce
> the problem with something similiar I was using GDB 5.0, not the
> cvs version. However that version also has problems with the
> following code.) Normally when I run the real application I have
> SIGSTOP and SIGCONT set to nostop, which may be why it isn't seen
> until a breakpoint is used, whereas here it happens after the
> implicit SIGCONT breakpoint.
>
> Hmm. GDB heavily relies on SIGSTOP itself. There is no other way to
> stop threads in Linux :-(. Due to the nature of signals (particularly
> the fact that multiple signals might be merged into one), this rather
> hoplessly interferes with the SIGSTOPs you're using in your program.
> I really don't intend to fix this. Sorry.
And my application requires the occassional use of SIGSTOP for
stopping threads (as you said, there is no other way to do it, at
least not that I can find.) However I am not exactly sure what the
cause of the problem is. Especially considering that a signal is
sent to a single thread and not all threads (with the possible
exceptions of the main thread or signals from the shell). This
behavior is where Linux is different than standard PTHREADS
(otherwise the use of SIGSTOP would be a bad thing for my
application.)
Explicitly stopping individual threads is considered bad practice by
most threads experts. And of course using SIGSTOP is unportable.
That's why I don't consider this a critical problem.
I'd be delighted if you can find a way to make things work. I just
don't see how.
Another problem that I am seeing with the threading is that exiting
threads are ending up defunct rather than going away while using
GDB (correct behavior is seen w/o GDB). Is SIGCHLD is being handled
correctly? IIRC that is the cause of that.
It's a kernel bug (actually two in the latest kernels). I sent Linus
some patches but thus far they didn't make it into the kernel.
Mark