public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 5/5] gdb: make target_desc_info_from_user_p a method of target_desc_info
Date: Fri,  3 Feb 2023 09:21:26 -0500	[thread overview]
Message-ID: <20230203142126.286866-6-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20230203142126.286866-1-simon.marchi@polymtl.ca>

Move the implementation over to target_desc_info.  Remove the
target_desc_info forward declaration in target-descriptions.h, it's no
longer needed.

Change-Id: Ic95060341685afe0b73af591ca6efe32f5e7e892
---
 gdb/inferior.c            | 2 +-
 gdb/inferior.h            | 5 +++++
 gdb/target-descriptions.c | 8 --------
 gdb/target-descriptions.h | 8 --------
 4 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/gdb/inferior.c b/gdb/inferior.c
index 65863440b9c0..a1e3c79d8a20 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -961,7 +961,7 @@ clone_inferior_command (const char *args, int from_tty)
 
       /* If the original inferior had a user specified target
 	 description, make the clone use it too.  */
-      if (target_desc_info_from_user_p (&inf->tdesc_info))
+      if (inf->tdesc_info.from_user_p ())
 	inf->tdesc_info = orginf->tdesc_info;
 
       clone_program_space (pspace, orginf->pspace);
diff --git a/gdb/inferior.h b/gdb/inferior.h
index d902881bfe24..bac483f0f78d 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -345,6 +345,11 @@ extern void switch_to_inferior_no_thread (inferior *inf);
 
 struct target_desc_info
 {
+  /* Returns true if INFO indicates the target description had been supplied by
+     the user.  */
+  bool from_user_p ()
+  { return !this->filename.empty (); }
+
   /* A flag indicating that a description has already been fetched
      from the target, so it should not be queried again.  */
   bool fetched = false;
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 6defd5bbe863..b08a185dfa21 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -451,14 +451,6 @@ get_arch_data (struct gdbarch *gdbarch)
   return result;
 }
 
-/* See target-descriptions.h.  */
-
-int
-target_desc_info_from_user_p (struct target_desc_info *info)
-{
-  return info != nullptr && !info->filename.empty ();
-}
-
 /* The string manipulated by the "set tdesc filename ..." command.  */
 
 static std::string tdesc_filename_cmd_string;
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index b835e144c680..ee48fdfaa0c2 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -26,9 +26,6 @@
 
 struct tdesc_arch_data;
 struct target_ops;
-/* An inferior's target description info is stored in this opaque
-   object.  There's one such object per inferior.  */
-struct target_desc_info;
 struct inferior;
 
 /* Fetch the current inferior's description, and switch its current
@@ -48,11 +45,6 @@ void target_clear_description (void);
 
 const struct target_desc *target_current_description (void);
 
-/* Returns true if INFO indicates the target description had been
-   supplied by the user.  */
-
-int target_desc_info_from_user_p (struct target_desc_info *info);
-
 /* Record architecture-specific functions to call for pseudo-register
    support.  If tdesc_use_registers is called and gdbarch_num_pseudo_regs
    is greater than zero, then these should be called as well.
-- 
2.39.1


  parent reply	other threads:[~2023-02-03 14:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 14:21 [PATCH 0/5] Some target_desc_info cleanups Simon Marchi
2023-02-03 14:21 ` [PATCH 1/5] gdb: move target_desc_info to inferior.h Simon Marchi
2023-02-03 14:21 ` [PATCH 2/5] gdb: change inferior::tdesc_info to non-pointer Simon Marchi
2023-02-03 14:21 ` [PATCH 3/5] gdb: remove get_tdesc_info Simon Marchi
2023-02-03 15:53   ` Andrew Burgess
2023-02-03 16:05     ` Simon Marchi
2023-02-03 14:21 ` [PATCH 4/5] gdb: remove copy_inferior_target_desc_info Simon Marchi
2023-02-03 15:54   ` Andrew Burgess
2023-02-03 16:05     ` Simon Marchi
2023-02-03 14:21 ` Simon Marchi [this message]
2023-02-06 18:41   ` [PATCH 5/5] gdb: make target_desc_info_from_user_p a method of target_desc_info Pedro Alves
2023-02-06 19:13     ` Simon Marchi
2023-02-03 15:56 ` [PATCH 0/5] Some target_desc_info cleanups Andrew Burgess
2023-02-03 16:07   ` 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=20230203142126.286866-6-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --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).