From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/python: avoid switching threads for send_packet where possible
Date: Fri, 29 May 2026 08:32:47 -0600 [thread overview]
Message-ID: <878q925lrk.fsf@tromey.com> (raw)
In-Reply-To: <feca6400c920ed54a6449871d8d7be47343c9e5f.1779810573.git.aburgess@redhat.com> (Andrew Burgess's message of "Tue, 26 May 2026 16:50:12 +0100")
>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
Andrew> Bug PR gdb/32120 identifies a case where a user tried to write a
Andrew> custom frame unwinder that made use of
Andrew> RemoteTargetConnection.send_packet
Just for the record this seems like a weird and bad choice.
Andrew> scoped_restore_current_thread restore_thread;
Andrew> switch_to_target_no_thread (conn->target);
Andrew> The purpose of this is to ensure that the currently selected inferior
Andrew> has the required remote connection pushed on its target stack. This
Andrew> is necessary because `send_remote_packet` (see remote.c) still relies
Andrew> on global state read from the currently selected inferior.
Andrew> Switching inferior and thread like this, and then switching back
Andrew> thanks to the scoped restore, will flush the frame cache.
...
Andrew> I propose that we special case connpy_send_packet so if the correct
Andrew> inferior is already current then we avoid the switch completely. This
Andrew> avoids flushing the frame cache, and all the associated problems.
No problem with the patch at all, but I wonder about the logic of
putting this check here and not elsewhere. Like would we want some sort
of "switch to this inferior and we don't care which thread" -- which
would be a no-op if the inferior is already selected?
Tom
next prev parent reply other threads:[~2026-05-29 14:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 15:50 Andrew Burgess
2026-05-29 14:32 ` Tom Tromey [this message]
2026-06-07 19:58 ` Andrew Burgess
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=878q925lrk.fsf@tromey.com \
--to=tom@tromey.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
/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