From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 2/5] gdb: add inferior parameter to architecture_changed observable
Date: Fri, 29 Sep 2023 14:24:36 -0400 [thread overview]
Message-ID: <20230929182541.138320-3-simon.marchi@efficios.com> (raw)
In-Reply-To: <20230929182541.138320-1-simon.marchi@efficios.com>
This is to make it explicit which inferior's architecture just changed,
and that the callbacks should not assume it is the current inferior.
Update the only caller, pyuw_on_new_gdbarch, to add the parameter,
although it doesn't use it currently.
Change-Id: Ieb7f21377e4252cc6e7b1ce2cc812cd1a1840e0e
---
gdb/arch-utils.c | 3 ++-
gdb/observable.h | 5 +++--
gdb/python/py-unwind.c | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 748ca3535c2e..91bd540dd9a9 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -1479,7 +1479,8 @@ set_target_gdbarch (struct gdbarch *new_gdbarch)
gdb_assert (new_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
current_inferior ()->set_arch (new_gdbarch);
- gdb::observers::architecture_changed.notify (new_gdbarch);
+ gdb::observers::architecture_changed.notify (current_inferior (),
+ new_gdbarch);
registers_changed ();
}
diff --git a/gdb/observable.h b/gdb/observable.h
index 464d0b70f5b5..22949449d694 100644
--- a/gdb/observable.h
+++ b/gdb/observable.h
@@ -151,9 +151,10 @@ extern observable<struct breakpoint */* b */> breakpoint_deleted;
is the modified breakpoint. */
extern observable<struct breakpoint */* b */> breakpoint_modified;
-/* The current architecture has changed. The argument NEWARCH is a
+/* INF's architecture has changed. The argument NEWARCH is a
pointer to the new architecture. */
-extern observable<struct gdbarch */* newarch */> architecture_changed;
+extern observable<inferior */* inf */, struct gdbarch */* newarch */>
+ architecture_changed;
/* The thread's ptid has changed. The OLD_PTID parameter specifies
the old value, and NEW_PTID specifies the new value. */
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index 1856e41e2a1b..f8b142dd52c1 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -945,7 +945,7 @@ static const registry<gdbarch>::key<pyuw_gdbarch_data_type> pyuw_gdbarch_data;
intermediary. */
static void
-pyuw_on_new_gdbarch (struct gdbarch *newarch)
+pyuw_on_new_gdbarch (inferior *inf, gdbarch *newarch)
{
struct pyuw_gdbarch_data_type *data = pyuw_gdbarch_data.get (newarch);
if (data == nullptr)
--
2.42.0
next prev 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 ` Simon Marchi [this message]
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 ` [PATCH 5/5] gdb: scope down registers_changed call in inferior::set_arch Simon Marchi
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-3-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).