From: Klaus Gerlicher <klaus.gerlicher@intel.com>
To: gdb-patches@sourceware.org
Cc: aburgess@redhat.com, pedro@palves.net, kevinb@redhat.com, eliz@gnu.org
Subject: [PATCH v4 0/1] gdb: remember previously selected thread per inferior
Date: Fri, 11 Sep 2026 08:10:14 +0000 [thread overview]
Message-ID: <20260911081015.104335-1-klaus.gerlicher@intel.com> (raw)
From: "Gerlicher, Klaus" <klaus.gerlicher@intel.com>
Hi,
This is V4 of the patch to remember the selected thread when switching
between inferiors.
Thanks, Kevin, for the review. Sorry about that - I shamefully sent out
an unfinished/unrebased branch with V3, my workflow is just not well adjusted
to upstreaming since I don't do this too regularly. It failed to build
and had failing tests and I didn't realize. Apologies for the noise, addressing
your findings here, anything else is in V3:
https://inbox.sourceware.org/gdb-patches/20260908133426.444197-1-klaus.gerlicher@intel.com/
Changes since V3:
* Fixed build failure: 'stored_tp->state' -> 'stored_tp->state ()',
since thread_info::state is now a member function.
* Fixed test compile issue in inferior-switch.c.
* Fixed the test failures you reported: prepare_test in
inferior-switch.exp now explicitly enables
'set remember-threads-per-inferior on', since the feature defaults to
off as of V3 and the tests never turned it on.
* Reworded the texinfo doc per Eli's earlier feedback: "the thread that
was selected" instead of "the thread that was active".
* Fixed a gap found while re-testing: turning the feature on with
'set remember-threads-per-inferior on' didn't record anything for the
inferior currently on - only future explicit/implicit switches
got captured. Added a set_func on the setting that captures the
current thread right away when enabled.
* Added a regression test for that gap; the old tests wouldn't have
caught it.
* Fixed two stale comments left over from before the set_func was added
(one claimed there were only two save mechanisms, the other described
save_inferior_last_thread's callers too narrowly).
* Documented test_disabled_behavior in the file's header comment; it was
missing from the list.
Verified this time:
* Rebuilt from a clean checkout against current master.
* gdb.base/inferior-switch.exp: 47/47 pass.
* gdb.mi/user-selected-context-sync.exp: 483/483 pass.
Tested on x86_64 and aarch64.
Thanks,
Klaus
Gerlicher, Klaus (1):
gdb: remember previously selected thread per inferior
gdb/NEWS | 8 +
gdb/doc/gdb.texinfo | 20 ++
gdb/gdbthread.h | 4 +
gdb/inferior.c | 76 ++++++-
gdb/inferior.h | 14 ++
gdb/infrun.c | 12 +-
gdb/testsuite/gdb.base/inferior-switch.c | 42 ++++
gdb/testsuite/gdb.base/inferior-switch.exp | 187 ++++++++++++++++++
.../gdb.mi/user-selected-context-sync.exp | 14 ++
gdb/thread.c | 8 +
10 files changed, 382 insertions(+), 3 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/inferior-switch.c
create mode 100644 gdb/testsuite/gdb.base/inferior-switch.exp
--
2.34.1
________________________________________
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 (89) 99143-0
www.intel.de
Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman
Chairperson of the Supervisory Board: Sonja Pierer
Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
next reply other threads:[~2026-09-11 8:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 8:10 Klaus Gerlicher [this message]
2026-09-11 8:10 ` [PATCH v4 1/1] " Klaus Gerlicher
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=20260911081015.104335-1-klaus.gerlicher@intel.com \
--to=klaus.gerlicher@intel.com \
--cc=aburgess@redhat.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
--cc=pedro@palves.net \
/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