From: Michael Snyder <msnyder@redhat.com>
To: Hilfinger@otisco.mckusick.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] lin-lwp.c change to avoid obscure hanging
Date: Fri, 19 Apr 2002 11:53:00 -0000 [thread overview]
Message-ID: <3CC064E4.55E3C68C@redhat.com> (raw)
In-Reply-To: <200204170952.CAA17455@otisco.McKusick.COM>
"Paul N. Hilfinger" wrote:
>
> > > 3. The user executes the commands
> > > delete
> > > thread B
> > > continue
>
> > This isn't really a sensable thing to do anyway.
> > Probably the user is imagining that this will cause
> > thread B to be treated in some way specially (eg.
> > resumed before the others), but it will not
> > (or at least it should not).
>
> Oh, I'm SO glad you brought this up, because it is a point that could stand
> clarification.
>
> Q1. Consider the following sequence (user input preceded by prompts)
>
> (gdb) run
> ...
> Breakpoint 1, philosopher ...
> (gdb) info thread
> * 7 Thread 5126 (runnable) ...
> ...
> (gdb) thread 6 # I.e., Some thread other than the current one
> (gdb) signal 1
>
> What is supposed to happen? What DOES happen (on Linux) is that thread 7
> receives SIGHUP.
There are actually three predicates here:
- what is supposed to happen
- what does happen
- what is expected to happen.
What you describe above (thread 7 receives the signal)
is what is expected to happen.
GDB's thread model is lacking in several areas, and one of them
is the ability to resume a thread other than the one that stopped.
Since we have not designed an interface for doing this in general,
we don't do it at all (even on platforms such as Linux where it
might be possible). So the thread that resumes is always the
thread that stopped, no matter what thread you switch to in the
mean time.
>
> Q2. Now consider what happens when one thread is sent an asynchronous SIGHUP
> (on Linux, there are kernel threads, and you can address a signal to
> a specific thread from the command line with the kill command).
>
> (gdb) run
> ...
> Program received signal SIGHUP, Hangup.
> ...
> (gdb) info thread
> * 7 Thread 5126 (runnable) ...
> ...
> (gdb) thread 6
> (gdb) cont
>
> Here what happens is that thread *6* receives SIGHUP.
Ugh! Well, that's a bug.
That's not what is "supposed" or "expected" to happen.
>
> Q3. Finally, we have
>
> (gdb) run
> ...
> Program received signal SIGHUP, Hangup.
> ...
> (gdb) info thread
> * 7 Thread 5126 (runnable) ...
> ...
> (gdb) thread 6
> (gdb) signal 1
>
> Again, thread 6 receives SIGHUP.
No, that's a bug too.
> Question: How much of this, if any, is intentional? What should happen in
> these cases?
Q1 is intentional, Q2 and Q3 are not.
Michael
next prev parent reply other threads:[~2002-04-19 18:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-12 12:43 [RFA] Change to parse error reporting Michael Snyder
2002-04-13 2:05 ` [RFA] lin-lwp.c change to avoid obscure hanging Paul N. Hilfinger
2002-04-15 18:10 ` Michael Snyder
2002-04-17 2:52 ` Paul N. Hilfinger
2002-04-19 11:53 ` Michael Snyder [this message]
2002-04-19 11:54 ` [RFA] Change to parse error reporting Michael Snyder
2002-04-24 15:23 ` Michael Snyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3CC064E4.55E3C68C@redhat.com \
--to=msnyder@redhat.com \
--cc=Hilfinger@otisco.mckusick.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox