public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 1/3] Remove current_target_so_ops
Date: Mon,  8 Aug 2022 13:27:59 -0600	[thread overview]
Message-ID: <20220808192801.260256-2-tromey@adacore.com> (raw)
In-Reply-To: <20220808192801.260256-1-tromey@adacore.com>

current_target_so_ops is only set in a single place.  It seems better
to simply remove it.
---
 gdb/solib-target.c | 5 -----
 gdb/solib.c        | 9 +++------
 gdb/solist.h       | 3 ---
 3 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index 54b98243e51..8def640a1e7 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -453,9 +453,4 @@ _initialize_solib_target ()
   solib_target_so_ops.in_dynsym_resolve_code
     = solib_target_in_dynsym_resolve_code;
   solib_target_so_ops.bfd_open = solib_bfd_open;
-
-  /* Set current_target_so_ops to solib_target_so_ops if not already
-     set.  */
-  if (current_target_so_ops == 0)
-    current_target_so_ops = &solib_target_so_ops;
 }
diff --git a/gdb/solib.c b/gdb/solib.c
index 25adf586a02..859d345f39c 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -53,6 +53,7 @@
 #include "debuginfod-support.h"
 #include "source.h"
 #include "cli/cli-style.h"
+#include "solib-target.h"
 
 /* Architecture-specific operations.  */
 
@@ -67,8 +68,8 @@ solib_ops (struct gdbarch *gdbarch)
   const struct target_so_ops *result = solib_data.get (gdbarch);
   if (result == nullptr)
     {
-      result = current_target_so_ops;
-      set_solib_ops (gdbarch, current_target_so_ops);
+      result = &solib_target_so_ops;
+      set_solib_ops (gdbarch, &solib_target_so_ops);
     }
   return result;
 }
@@ -84,10 +85,6 @@ set_solib_ops (struct gdbarch *gdbarch, const struct target_so_ops *new_ops)
 
 /* external data declarations */
 
-/* FIXME: gdbarch needs to control this variable, or else every
-   configuration needs to call set_solib_ops.  */
-struct target_so_ops *current_target_so_ops;
-
 /* Local function prototypes */
 
 /* If non-empty, this is a search path for loading non-absolute shared library
diff --git a/gdb/solist.h b/gdb/solist.h
index 34198dc0c4d..f102605e076 100644
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -194,7 +194,4 @@ extern gdb_bfd_ref_ptr solib_bfd_fopen (const char *pathname, int fd);
 /* Find solib binary file and open it.  */
 extern gdb_bfd_ref_ptr solib_bfd_open (const char *in_pathname);
 
-/* FIXME: gdbarch needs to control this variable.  */
-extern struct target_so_ops *current_target_so_ops;
-
 #endif
-- 
2.34.1


  reply	other threads:[~2022-08-08 19:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 19:27 [PATCH 0/3] Clean up solib_ops Tom Tromey
2022-08-08 19:27 ` Tom Tromey [this message]
2022-08-08 19:28 ` [PATCH 2/3] Move solib_ops into gdbarch Tom Tromey
2022-08-08 19:28 ` [PATCH 3/3] Constify some target_so_ops instances Tom Tromey
2022-09-20 18:40 ` [PATCH 0/3] Clean up solib_ops Tom Tromey

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=20220808192801.260256-2-tromey@adacore.com \
    --to=tromey@adacore.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).