[binutils-gdb] gdb/solib: make implementation of solib_ops::open_symbol_file_object optional
Simon Marchi
simark@sourceware.org
Thu May 29 15:08:20 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=134767de03c9b95c285758da98156484e31c8342
commit 134767de03c9b95c285758da98156484e31c8342
Author: Simon Marchi <simon.marchi@efficios.com>
Date: Mon May 26 16:26:15 2025 -0400
gdb/solib: make implementation of solib_ops::open_symbol_file_object optional
The only solib implementation that implements open_symbol_file_object is
SVR4. All others just return 0. Make it optional, to avoid having
these empty functions.
Change-Id: I835197a73323d39231d071f9a9eaac2553f10726
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Diff:
---
gdb/solib-aix.c | 10 +---------
gdb/solib-darwin.c | 12 +-----------
gdb/solib-dsbt.c | 11 +----------
gdb/solib-frv.c | 11 +----------
gdb/solib-target.c | 10 +---------
gdb/solib.c | 3 ++-
6 files changed, 7 insertions(+), 50 deletions(-)
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 4eb89e9341b..7ff9bf4482e 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -489,14 +489,6 @@ solib_aix_current_sos ()
return sos;
}
-/* Implement the "open_symbol_file_object" solib_ops method. */
-
-static int
-solib_aix_open_symbol_file_object (int from_tty)
-{
- return 0;
-}
-
/* Implement the "in_dynsym_resolve_code" solib_ops method. */
static bool
@@ -683,7 +675,7 @@ const solib_ops solib_aix_so_ops =
nullptr,
solib_aix_solib_create_inferior_hook,
solib_aix_current_sos,
- solib_aix_open_symbol_file_object,
+ nullptr,
solib_aix_in_dynsym_resolve_code,
solib_aix_bfd_open,
nullptr,
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 86a71bb2280..14db2efd735 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -188,16 +188,6 @@ find_program_interpreter (void)
return buf;
}
-/* Not used. I don't see how the main symbol file can be found: the
- interpreter name is needed and it is known from the executable file.
- Note that darwin-nat.c implements pid_to_exec_file. */
-
-static int
-open_symbol_file_object (int from_tty)
-{
- return 0;
-}
-
/* Build a list of currently loaded shared objects. See solib-svr4.c. */
static owning_intrusive_list<solib>
@@ -649,7 +639,7 @@ const solib_ops darwin_so_ops =
darwin_clear_solib,
darwin_solib_create_inferior_hook,
darwin_current_sos,
- open_symbol_file_object,
+ nullptr,
darwin_in_dynsym_resolve_code,
darwin_bfd_open,
nullptr,
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index ed6580eca0f..2b315369280 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -392,15 +392,6 @@ fetch_loadmap (CORE_ADDR ldmaddr)
static void dsbt_relocate_main_executable (void);
static int enable_break (void);
-/* See solib.h. */
-
-static int
-open_symbol_file_object (int from_tty)
-{
- /* Unimplemented. */
- return 0;
-}
-
/* Given a loadmap and an address, return the displacement needed
to relocate the address. */
@@ -909,7 +900,7 @@ const solib_ops dsbt_so_ops =
dsbt_clear_solib,
dsbt_solib_create_inferior_hook,
dsbt_current_sos,
- open_symbol_file_object,
+ nullptr,
dsbt_in_dynsym_resolve_code,
solib_bfd_open,
nullptr,
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 0ccbf903309..ceef72208a1 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -236,15 +236,6 @@ static void frv_relocate_main_executable (void);
static CORE_ADDR main_got (void);
static int enable_break2 (void);
-/* Implement the "open_symbol_file_object" solib_ops method. */
-
-static int
-open_symbol_file_object (int from_tty)
-{
- /* Unimplemented. */
- return 0;
-}
-
/* Cached value for lm_base(), below. */
static CORE_ADDR lm_base_cache = 0;
@@ -1080,7 +1071,7 @@ const solib_ops frv_so_ops =
frv_clear_solib,
frv_solib_create_inferior_hook,
frv_current_sos,
- open_symbol_file_object,
+ nullptr,
frv_in_dynsym_resolve_code,
solib_bfd_open,
nullptr,
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index 7ccb87daa95..c20a843449b 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -382,14 +382,6 @@ Could not relocate shared library \"%s\": bad offsets"), so.name.c_str ());
sec->endaddr += offset;
}
-static int
-solib_target_open_symbol_file_object (int from_tty)
-{
- /* We can't locate the main symbol file based on the target's
- knowledge; the user has to specify it. */
- return 0;
-}
-
static bool
solib_target_in_dynsym_resolve_code (CORE_ADDR pc)
{
@@ -406,7 +398,7 @@ const solib_ops solib_target_so_ops =
nullptr,
solib_target_solib_create_inferior_hook,
solib_target_current_sos,
- solib_target_open_symbol_file_object,
+ nullptr,
solib_target_in_dynsym_resolve_code,
solib_bfd_open,
nullptr,
diff --git a/gdb/solib.c b/gdb/solib.c
index 8a997a40c22..e357803bc76 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -723,7 +723,8 @@ update_solib_list (int from_tty)
have not opened a symbol file, we may be able to get its
symbols now! */
if (inf->attach_flag
- && current_program_space->symfile_object_file == NULL)
+ && current_program_space->symfile_object_file == nullptr
+ && ops->open_symbol_file_object != nullptr)
{
try
{
More information about the Gdb-cvs
mailing list