From d5ef1fc2824b3d9866fd01658dc2cad8f03f08df Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 26 May 2025 16:26:16 -0400 Subject: [PATCH] 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 --- gdb/solib-aix.c | 10 +--------- gdb/solib-darwin.c | 11 +---------- gdb/solib.c | 6 ++++-- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index 7ff9bf4482e..4af83de4d37 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 14db2efd735..4003c77748c 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 e357803bc76..ba12c785d98 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. */ -- 2.39.5