gdb/solib: make solib_ops::in_dynsym_resolve_code optional
Two solib ops implementations have dummy implementations for the
in_dynsym_resolve_code callback. Make it optional, to avoid this.
Change-Id: I786776fb82ce1b96335a97713fbfe8074c84c00c
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 7ff9bf4..4af83de 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -489,14 +489,6 @@ solib_aix_current_sos ()
return sos;
}
-/* Implement the "in_dynsym_resolve_code" solib_ops method. */
-
-static bool
-solib_aix_in_dynsym_resolve_code (CORE_ADDR pc)
-{
- return false;
-}
-
/* Implement the "bfd_open" solib_ops method. */
static gdb_bfd_ref_ptr
@@ -676,7 +668,7 @@ const solib_ops solib_aix_so_ops =
solib_aix_solib_create_inferior_hook,
solib_aix_current_sos,
nullptr,
- solib_aix_in_dynsym_resolve_code,
+ nullptr,
solib_aix_bfd_open,
nullptr,
nullptr,
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 14db2ef..4003c77 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -353,15 +353,6 @@ darwin_read_exec_load_addr_at_init (struct darwin_info *info)
return darwin_validate_exec_header (load_addr);
}
-/* Return true if PC lies in the dynamic symbol resolution code of the
- run time loader. */
-
-static bool
-darwin_in_dynsym_resolve_code (CORE_ADDR pc)
-{
- return false;
-}
-
/* A wrapper for bfd_mach_o_fat_extract that handles reference
counting properly. This will either return NULL, or return a new
reference to a BFD. */
@@ -640,7 +631,7 @@ const solib_ops darwin_so_ops =
darwin_solib_create_inferior_hook,
darwin_current_sos,
nullptr,
- darwin_in_dynsym_resolve_code,
+ nullptr,
darwin_bfd_open,
nullptr,
nullptr,
diff --git a/gdb/solib.c b/gdb/solib.c
index e357803..ba12c78 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1325,8 +1325,10 @@ solib_create_inferior_hook (int from_tty)
bool
in_solib_dynsym_resolve_code (CORE_ADDR pc)
{
- return (gdbarch_so_ops (current_inferior ()->arch ())
- ->in_dynsym_resolve_code (pc));
+ const auto in_dynsym_resolve_code
+ = gdbarch_so_ops (current_inferior ()->arch ())->in_dynsym_resolve_code;
+
+ return in_dynsym_resolve_code && in_dynsym_resolve_code (pc);
}
/* Implements the "sharedlibrary" command. */