From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@redhat.com>,
Jan Kratochvil <jan.kratochvil@redhat.com>,
gdb-patches@sourceware.org
Subject: Re: RFC: fix crash when inferior exits during "continue"
Date: Tue, 14 Feb 2012 14:19:00 -0000 [thread overview]
Message-ID: <4F3A6D51.5010904@redhat.com> (raw)
In-Reply-To: <20120214134417.GA6730@redhat.com>
On 02/14/2012 01:44 PM, Gary Benson wrote:
> Tom Tromey wrote:
>>>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>>
>> Jan> Maybe during make_cleanup_restore_current_thread temporarily
>> Jan> remember + clear inferior-> removable instead.
>>
>> I hadn't considered this, but it is an interesting idea.
>>
>> It would have the maybe odd effect of leaving the dead inferior
>> around as long as it was selected. Maybe this is even the clearest
>> thing to do; I am not sure.
>>
>> Do you (or anybody) have an opinion on which is better?
>
> I'm not especially familiar with this area of GDB, but I prefer the
> idea of holding the selection on the dead inferior over arbitrarily
> selecting another. I think the latter could be confusing.
Yeah. We also don't randomly switch to another thread if the previous
selected thread exits (and this is the reason we have "exited" threads).
Otherwise, if the user is typing
(gdb) some_command_that_applies_to_the_current_thread <enter>
and the current thread disappears while the user is typing,
the command ends up being applied to a random thread, which is
not good.
In this case, we need to step back a little. Why are we removing
the inferior at all? The whole idea of inf->removable was that
when you run, say, "make check" under gdb, and you follow all forks,
you don't want to end up with 1000 inferiors loaded. So gdb marks
inferiors/forks that appeared not by explicit user action
as "removable". Those that are removable are pruned by prune_inferiors,
roughly whenever we handle an event that gives the prompt to the
user (at the end of normal_stop).
But in this case, the user explicitly switched to a "removable"
inferior, and then resumed (inferior 2; continue; <crash, inf2 is gone>)
So we may consider two things:
- The inferior should no longer be "removable". The user has
expressed interest in it.
- Make make_cleanup_restore_current_thread "lock" the current
inferior, so it isn't removed even if it is "removable".
We do something similar for threads -- That's the whole reason
for thread_info->refcount. (This is also Jan's suggestion.)
--
Pedro Alves
next prev parent reply other threads:[~2012-02-14 14:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-07 19:14 Tom Tromey
2012-02-10 14:41 ` Jan Kratochvil
2012-02-10 20:05 ` Tom Tromey
2012-02-14 13:44 ` Gary Benson
2012-02-14 14:19 ` Pedro Alves [this message]
2012-02-15 22:24 ` Tom Tromey
2012-02-16 12:45 ` Pedro Alves
2012-02-16 14:42 ` Tom Tromey
2012-02-16 15:24 ` Tom Tromey
2012-02-20 2:41 ` [patch] testsuite: Fix inferior-died.exp racy FAILs [Re: RFC: fix crash when inferior exits during "continue"] Jan Kratochvil
2012-02-20 21:05 ` [commit] " Jan Kratochvil
2012-02-20 21:24 ` Tom Tromey
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=4F3A6D51.5010904@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=tromey@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