public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 5/5] gdb: scope down registers_changed call in inferior::set_arch
Date: Fri, 29 Sep 2023 14:24:39 -0400	[thread overview]
Message-ID: <20230929182541.138320-6-simon.marchi@efficios.com> (raw)
In-Reply-To: <20230929182541.138320-1-simon.marchi@efficios.com>

inferior::set_arch calls registers_changed, which invalidates all
regcaches.  It would be enough to invalidate only regcaches of threads
belonging to this inferior.  Call registers_changed_ptid instead, with
the proper process target / ptid.  If the inferior does not have a
process target, there should be no regcaches for that inferior, so no
need to invalidate anything.

Change-Id: Id8b5500acb7f373b01a534f16d3a7d028dc0d882
---
 gdb/inferior.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/inferior.c b/gdb/inferior.c
index 21795a0d8a42..efe57cceae3e 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -180,7 +180,10 @@ inferior::set_arch (gdbarch *arch)
   gdb_assert (gdbarch_initialized_p (arch));
   m_gdbarch = arch;
   gdb::observers::architecture_changed.notify (this, arch);
-  registers_changed ();
+
+  process_stratum_target *proc_target = this->process_target ();
+  if (proc_target != nullptr)
+    registers_changed_ptid (proc_target, ptid_t (this->pid));
 }
 
 void
-- 
2.42.0


  parent reply	other threads:[~2023-09-29 18:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-29 18:24 [PATCH 0/5] Various inferior / arch cleanups Simon Marchi
2023-09-29 18:24 ` [PATCH 1/5] gdb: add inferior::{arch, set_arch} Simon Marchi
2023-09-29 18:24 ` [PATCH 2/5] gdb: add inferior parameter to architecture_changed observable Simon Marchi
2023-09-29 18:24 ` [PATCH 3/5] gdb: move set_target_gdbarch to inferior::set_arch Simon Marchi
2023-09-29 18:24 ` [PATCH 4/5] gdb: remove target_gdbarch Simon Marchi
2023-09-29 18:24 ` Simon Marchi [this message]
2023-10-06 22:05 ` [PATCH 0/5] Various inferior / arch cleanups John Baldwin
2023-10-10 14:43   ` Simon Marchi
2023-10-10 14:55     ` Guinevere Larsen
2023-10-10 15:05       ` Simon Marchi
2023-10-09  9:42 ` Andrew Burgess
2023-10-10 14:48   ` Simon Marchi

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=20230929182541.138320-6-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).