From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] gdb/infrun: make fetch_inferior_event restore thread if exited or signalled
Date: Fri, 29 Apr 2022 13:37:37 +0100 [thread overview]
Message-ID: <14995a4d-d5e6-2539-c07f-aae7f0d04cd4@palves.net> (raw)
In-Reply-To: <20220424032049.1021263-2-simon.marchi@polymtl.ca>
On 2022-04-24 04:20, Simon Marchi via Gdb-patches wrote:
> Change-Id: Ibc7df543e2c46aad5f3b9250b28c3fb5912be4e8
> ---
> gdb/infrun.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index 4e7ca803c798..6dccb7a2ff2a 100644
Looks fine.
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -4052,12 +4052,19 @@ reinstall_readline_callback_handler_cleanup ()
> static void
> clean_up_just_stopped_threads_fsms (struct execution_control_state *ecs)
> {
> + /* The first clean_up call below assumes the event thread is the current
> + one. */
> + if (ecs->event_thread != nullptr)
> + gdb_assert (ecs->event_thread == inferior_thread ());
> +
> if (ecs->event_thread != nullptr
> && ecs->event_thread->thread_fsm () != nullptr)
> ecs->event_thread->thread_fsm ()->clean_up (ecs->event_thread);
>
> if (!non_stop)
> {
> + scoped_restore_current_thread restore_thread;
> +
> for (thread_info *thr : all_non_exited_threads ())
> {
> if (thr->thread_fsm () == nullptr)
> @@ -4068,9 +4075,6 @@ clean_up_just_stopped_threads_fsms (struct execution_control_state *ecs)
> switch_to_thread (thr);
> thr->thread_fsm ()->clean_up (thr);
We could also look at eliminating the need to switch the thread
when we're about to call a function that takes an explicit thread_info pointer,
but I'm fine with what you have, especially since in practice that would just probably
mean a scoped_restore_current_thread per clean_up call instead of a just a single one for
all threads...
next prev parent reply other threads:[~2022-04-29 12:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-24 3:20 [PATCH 0/2] Fix regressions caused by prune_threads patch Simon Marchi
2022-04-24 3:20 ` [PATCH 1/2] gdb/infrun: make fetch_inferior_event restore thread if exited or signalled Simon Marchi
2022-04-25 17:21 ` Andrew Burgess
2022-04-26 12:43 ` Simon Marchi
2022-04-29 12:37 ` Pedro Alves [this message]
2022-04-29 13:25 ` Simon Marchi
2022-04-24 3:20 ` [PATCH 2/2] gdb/remote: return early from remote_check_symbols if waiting for stop reply Simon Marchi
2022-04-26 10:27 ` Andrew Burgess
2022-04-26 14:15 ` Simon Marchi
2022-04-27 10:11 ` Andrew Burgess
2022-04-27 14:01 ` Simon Marchi
2022-04-29 12:50 ` Pedro Alves
2022-04-29 14:53 ` Simon Marchi
2022-04-29 15:39 ` Pedro Alves
2022-04-29 15:56 ` Simon Marchi
2022-04-29 15:47 ` Pedro Alves
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=14995a4d-d5e6-2539-c07f-aae7f0d04cd4@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).