From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 1/5] gdb: add inferior parameter to target_current_description
Date: Thu, 24 Nov 2022 11:04:24 -0500 [thread overview]
Message-ID: <20221124160428.83804-2-simon.marchi@efficios.com> (raw)
In-Reply-To: <20221124160428.83804-1-simon.marchi@efficios.com>
From: Simon Marchi <simon.marchi@polymtl.ca>
Make target_current_description not dependent on the current inferior on
entry. Update all callers to pass the current inferior, so no change in
behavior is expected.
Change-Id: Ic3c501bc83eb6950db077001a96a5c70dc8ae942
---
gdb/arch-utils.c | 4 ++--
gdb/target-descriptions.c | 4 ++--
gdb/target-descriptions.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 7b84daf046e..dc67c632155 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -586,7 +586,7 @@ gdbarch_update_p (struct gdbarch_info info)
/* Check for the current target description. */
if (info.target_desc == NULL)
- info.target_desc = target_current_description ();
+ info.target_desc = target_current_description (current_inferior ());
new_gdbarch = gdbarch_find_by_info (info);
@@ -644,7 +644,7 @@ set_gdbarch_from_file (bfd *abfd)
struct gdbarch *gdbarch;
info.abfd = abfd;
- info.target_desc = target_current_description ();
+ info.target_desc = target_current_description (current_inferior ());
gdbarch = gdbarch_find_by_info (info);
if (gdbarch == NULL)
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 44dea711a39..0d50aadddb8 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -607,9 +607,9 @@ target_clear_description (void)
an existing gdbarch. */
const struct target_desc *
-target_current_description (void)
+target_current_description (inferior *inf)
{
- target_desc_info *tdesc_info = get_tdesc_info (current_inferior ());
+ target_desc_info *tdesc_info = get_tdesc_info (inf);
if (tdesc_info->fetched)
return tdesc_info->tdesc;
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index 3ab0ae2542d..3049b783e2f 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -46,7 +46,7 @@ void target_clear_description (void);
be used by gdbarch initialization code; most access should be
through an existing gdbarch. */
-const struct target_desc *target_current_description (void);
+const struct target_desc *target_current_description (inferior *inf);
/* Copy inferior target description data. Used for example when
handling (v)forks, where child's description is the same as 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 ` Simon Marchi [this message]
2022-11-24 16:04 ` [PATCH 2/5] gdb: add inferior parameter to set_target_gdbarch, rename to set_inferior_gdbarch Simon Marchi
2022-11-24 16:42 ` 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-2-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).