From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 2/5] gdb: add inferior parameter to set_target_gdbarch, rename to set_inferior_gdbarch
Date: Thu, 24 Nov 2022 11:04:25 -0500 [thread overview]
Message-ID: <20221124160428.83804-3-simon.marchi@efficios.com> (raw)
In-Reply-To: <20221124160428.83804-1-simon.marchi@efficios.com>
From: Simon Marchi <simon.marchi@polymtl.ca>
Add an inferior parameter, so it doesn't depend on the current
inferior. While at it, rename to set_inferior_gdbarch, I think that's a
better name than "target".
The sole observer of the architecture_changed observable,
pyuw_on_new_gdbarch, doesn't seem to depend on the current inferior.
Neither does registers_changed.
Update callers to pass the current inferior, no change in behavior is
expected.
Change-Id: I276e28eafd4740c94bc5233c81a86c01b4a6ae90
---
gdb/arch-utils.c | 16 ++++++++--------
gdb/gdbarch.h | 4 ++--
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index dc67c632155..92caa5c3c4a 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -617,7 +617,7 @@ gdbarch_update_p (struct gdbarch_info info)
"New architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
- set_target_gdbarch (new_gdbarch);
+ set_inferior_gdbarch (current_inferior (), new_gdbarch);
return 1;
}
@@ -649,7 +649,7 @@ set_gdbarch_from_file (bfd *abfd)
if (gdbarch == NULL)
error (_("Architecture of file not recognized."));
- set_target_gdbarch (gdbarch);
+ set_inferior_gdbarch (current_inferior (), gdbarch);
}
/* Initialize the current architecture. Update the ``set
@@ -1427,15 +1427,15 @@ gdbarch_find_by_info (struct gdbarch_info info)
return new_gdbarch;
}
-/* Make the specified architecture current. */
+/* See gdbarch.h. */
void
-set_target_gdbarch (struct gdbarch *new_gdbarch)
+set_inferior_gdbarch (inferior *inf, gdbarch *gdbarch)
{
- gdb_assert (new_gdbarch != NULL);
- gdb_assert (new_gdbarch->initialized_p);
- current_inferior ()->gdbarch = new_gdbarch;
- gdb::observers::architecture_changed.notify (new_gdbarch);
+ gdb_assert (gdbarch != nullptr);
+ gdb_assert (gdbarch->initialized_p);
+ inf->gdbarch = gdbarch;
+ gdb::observers::architecture_changed.notify (gdbarch);
registers_changed ();
}
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index f2ba5f97765..76ffddfe0ff 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -342,9 +342,9 @@ extern int gdbarch_update_p (struct gdbarch_info info);
extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
-/* Helper function. Set the target gdbarch to "gdbarch". */
+/* Set INF's the target gdbarch to "gdbarch". */
-extern void set_target_gdbarch (struct gdbarch *gdbarch);
+extern void set_inferior_gdbarch (inferior *inf, gdbarch *gdbarch);
/* A registry adaptor for gdbarch. This arranges to store the
--
2.37.3
next prev parent reply other threads:[~2022-11-24 16:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 16:04 [PATCH 0/5] Make some functions independent of current inferior Simon Marchi
2022-11-24 16:04 ` [PATCH 1/5] gdb: add inferior parameter to target_current_description Simon Marchi
2022-11-24 16:04 ` Simon Marchi [this message]
2022-11-24 16:42 ` [PATCH 2/5] gdb: add inferior parameter to set_target_gdbarch, rename to set_inferior_gdbarch Lancelot SIX
2022-11-24 16:47 ` Simon Marchi
2022-11-24 16:04 ` [PATCH 3/5] gdb: add inferior parameter to gdbarch_update_p Simon Marchi
2022-11-24 16:04 ` [PATCH 4/5] gdb: add inferior parameter to target_find_description Simon Marchi
2022-11-24 16:25 ` Simon Marchi
2022-11-24 16:04 ` [PATCH 5/5] gdb: add inferior parameter to target_clear_description 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=20221124160428.83804-3-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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).