diff options
Diffstat (limited to 'gdb/solib-dsbt.c')
-rw-r--r-- | gdb/solib-dsbt.c | 89 |
1 files changed, 42 insertions, 47 deletions
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index 908c78a..f18d9a2 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -1,5 +1,5 @@ /* Handle TIC6X (DSBT) shared libraries for GDB, the GNU Debugger. - Copyright (C) 2010-2024 Free Software Foundation, Inc. + Copyright (C) 2010-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -21,7 +21,6 @@ #include "inferior.h" #include "gdbcore.h" #include "solib.h" -#include "solist.h" #include "objfiles.h" #include "symtab.h" #include "command.h" @@ -121,7 +120,26 @@ struct dbst_ext_link_map ext_ptr l_next, l_prev; /* struct link_map *l_next, *l_prev; */ }; -/* Link map info to include in an allocated so_list entry */ +/* solib_ops for DSBT systems. */ + +struct dsbt_solib_ops : public solib_ops +{ + void relocate_section_addresses (solib &so, target_section *) const override; + void clear_solib (program_space *pspace) const override; + void create_inferior_hook (int from_tty) const override; + owning_intrusive_list<solib> current_sos () const override; + bool in_dynsym_resolve_code (CORE_ADDR pc) const override; +}; + +/* See solib-dsbt.h. */ + +solib_ops_up +make_dsbt_solib_ops () +{ + return std::make_unique<dsbt_solib_ops> (); +} + +/* Link map info to include in an allocated solib entry */ struct lm_info_dsbt final : public lm_info { @@ -393,15 +411,6 @@ fetch_loadmap (CORE_ADDR ldmaddr) static void dsbt_relocate_main_executable (void); static int enable_break (void); -/* See solist.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. */ @@ -434,7 +443,6 @@ static CORE_ADDR lm_base (void) { bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); - struct bound_minimal_symbol got_sym; CORE_ADDR addr; gdb_byte buf[TIC6X_PTR_SIZE]; dsbt_info *info = get_dsbt_info (current_program_space); @@ -451,8 +459,9 @@ lm_base (void) if (info->lm_base_cache) return info->lm_base_cache; - got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, - current_program_space->symfile_object_file); + bound_minimal_symbol got_sym + = lookup_minimal_symbol (current_program_space, "_GLOBAL_OFFSET_TABLE_", + current_program_space->symfile_object_file); if (got_sym.minsym != 0) { @@ -512,13 +521,13 @@ lm_base (void) themselves. The declaration of `struct solib' says which fields we provide values for. */ -static intrusive_list<solib> -dsbt_current_sos (void) +owning_intrusive_list<solib> +dsbt_solib_ops::current_sos () const { bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); CORE_ADDR lm_addr; dsbt_info *info = get_dsbt_info (current_program_space); - intrusive_list<solib> sos; + owning_intrusive_list<solib> sos; /* Make sure that the main executable has been relocated. This is required in order to find the address of the global offset table, @@ -594,7 +603,7 @@ dsbt_current_sos (void) break; } - solib *sop = new solib; + auto &sop = sos.emplace_back (*this); auto li = std::make_unique<lm_info_dsbt> (); li->map = loadmap; /* Fetch the name. */ @@ -612,12 +621,11 @@ dsbt_current_sos (void) gdb_printf (gdb_stdlog, "current_sos: name = %s\n", name_buf.get ()); - sop->so_name = name_buf.get (); - sop->so_original_name = sop->so_name; + sop.name = name_buf.get (); + sop.original_name = sop.name; } - sop->lm_info = std::move (li); - sos.push_back (*sop); + sop.lm_info = std::move (li); } else { @@ -631,11 +639,11 @@ dsbt_current_sos (void) return sos; } -/* Return 1 if PC lies in the dynamic symbol resolution code of the +/* Return true if PC lies in the dynamic symbol resolution code of the run time loader. */ -static int -dsbt_in_dynsym_resolve_code (CORE_ADDR pc) +bool +dsbt_solib_ops::in_dynsym_resolve_code (CORE_ADDR pc) const { dsbt_info *info = get_dsbt_info (current_program_space); @@ -851,8 +859,8 @@ dsbt_relocate_main_executable (void) For the DSBT shared library, the main executable needs to be relocated. The shared library breakpoints also need to be enabled. */ -static void -dsbt_solib_create_inferior_hook (int from_tty) +void +dsbt_solib_ops::create_inferior_hook (int from_tty) const { /* Relocate main executable. */ dsbt_relocate_main_executable (); @@ -865,8 +873,8 @@ dsbt_solib_create_inferior_hook (int from_tty) } } -static void -dsbt_clear_solib (program_space *pspace) +void +dsbt_solib_ops::clear_solib (program_space *pspace) const { dsbt_info *info = get_dsbt_info (pspace); @@ -877,8 +885,9 @@ dsbt_clear_solib (program_space *pspace) info->main_executable_lm_info = NULL; } -static void -dsbt_relocate_section_addresses (solib &so, target_section *sec) +void +dsbt_solib_ops::relocate_section_addresses (solib &so, + target_section *sec) const { int seg; auto *li = gdb::checked_static_cast<lm_info_dsbt *> (so.lm_info.get ()); @@ -904,21 +913,7 @@ show_dsbt_debug (struct ui_file *file, int from_tty, gdb_printf (file, _("solib-dsbt debugging is %s.\n"), value); } -const solib_ops dsbt_so_ops = -{ - dsbt_relocate_section_addresses, - nullptr, - dsbt_clear_solib, - dsbt_solib_create_inferior_hook, - dsbt_current_sos, - open_symbol_file_object, - dsbt_in_dynsym_resolve_code, - solib_bfd_open, -}; - -void _initialize_dsbt_solib (); -void -_initialize_dsbt_solib () +INIT_GDB_FILE (dsbt_solib) { /* Debug this file's internals. */ add_setshow_zuinteger_cmd ("solib-dsbt", class_maintenance, |