diff options
Diffstat (limited to 'gdb/solib-target.c')
-rw-r--r-- | gdb/solib-target.c | 66 |
1 files changed, 22 insertions, 44 deletions
diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 8f73d5d..770028d 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -1,6 +1,6 @@ /* Definitions for targets which report shared library events. - Copyright (C) 2007-2024 Free Software Foundation, Inc. + Copyright (C) 2007-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "objfiles.h" -#include "solist.h" +#include "solib.h" #include "symtab.h" #include "symfile.h" #include "target.h" @@ -30,7 +30,7 @@ struct lm_info_target final : public lm_info { /* The library's name. The name is normally kept in the struct - so_list; it is only here during XML parsing. */ + solib; it is only here during XML parsing. */ std::string name; /* The target can either specify segment bases or section bases, not @@ -226,8 +226,8 @@ solib_target_parse_libraries (const char *library) } #endif -static owning_intrusive_list<solib> -solib_target_current_sos (void) +owning_intrusive_list<solib> +target_solib_ops::current_sos () const { owning_intrusive_list<solib> sos; @@ -245,25 +245,20 @@ solib_target_current_sos (void) /* Build a struct solib for each entry on the list. */ for (lm_info_target_up &info : library_list) { - auto &new_solib = sos.emplace_back (); + auto &new_solib = sos.emplace_back (*this); /* We don't need a copy of the name in INFO anymore. */ - new_solib.so_name = std::move (info->name); - new_solib.so_original_name = new_solib.so_name; + new_solib.name = std::move (info->name); + new_solib.original_name = new_solib.name; new_solib.lm_info = std::move (info); } return sos; } -static void -solib_target_solib_create_inferior_hook (int from_tty) -{ - /* Nothing needed. */ -} - -static void -solib_target_relocate_section_addresses (solib &so, target_section *sec) +void +target_solib_ops::relocate_section_addresses (solib &so, + target_section *sec) const { CORE_ADDR offset; auto *li = gdb::checked_static_cast<lm_info_target *> (so.lm_info.get ()); @@ -291,7 +286,7 @@ solib_target_relocate_section_addresses (solib &so, target_section *sec) if (num_alloc_sections != li->section_bases.size ()) warning (_("\ Could not relocate shared library \"%s\": wrong number of ALLOC sections"), - so.so_name.c_str ()); + so.name.c_str ()); else { int bases_index = 0; @@ -334,7 +329,7 @@ Could not relocate shared library \"%s\": wrong number of ALLOC sections"), if (data == NULL) warning (_("\ -Could not relocate shared library \"%s\": no segments"), so.so_name.c_str ()); +Could not relocate shared library \"%s\": no segments"), so.name.c_str ()); else { ULONGEST orig_delta; @@ -345,7 +340,7 @@ Could not relocate shared library \"%s\": no segments"), so.so_name.c_str ()); li->segment_bases.size (), li->segment_bases.data ())) warning (_("\ -Could not relocate shared library \"%s\": bad offsets"), so.so_name.c_str ()); +Could not relocate shared library \"%s\": bad offsets"), so.name.c_str ()); /* Find the range of addresses to report for this library in "info sharedlibrary". Report any consecutive segments @@ -382,16 +377,8 @@ Could not relocate shared library \"%s\": bad offsets"), so.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 int -solib_target_in_dynsym_resolve_code (CORE_ADDR pc) +bool +target_solib_ops::in_dynsym_resolve_code (CORE_ADDR pc) const { /* We don't have a range of addresses for the dynamic linker; there may not be one in the program's address space. So only report @@ -399,19 +386,10 @@ solib_target_in_dynsym_resolve_code (CORE_ADDR pc) return in_plt_section (pc); } -const solib_ops solib_target_so_ops = +/* See solib-target.h. */ + +solib_ops_up +make_target_solib_ops () { - solib_target_relocate_section_addresses, - nullptr, - nullptr, - solib_target_solib_create_inferior_hook, - solib_target_current_sos, - solib_target_open_symbol_file_object, - solib_target_in_dynsym_resolve_code, - solib_bfd_open, - nullptr, - nullptr, - nullptr, - nullptr, - default_find_solib_addr, -}; + return std::make_unique<target_solib_ops> (); +} |