[5/5] gdb: scope down registers_changed call in inferior::set_arch

Message ID 20230929182541.138320-6-simon.marchi@efficios.com
State New
Headers
Series Various inferior / arch cleanups |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Simon Marchi Sept. 29, 2023, 6:24 p.m. UTC
  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(-)
  

Patch

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