diff options
Diffstat (limited to 'gdb/solib-dsbt.c')
-rw-r--r-- | gdb/solib-dsbt.c | 81 |
1 files changed, 36 insertions, 45 deletions
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index 3832a7a..f18d9a2 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -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. */ @@ -512,8 +521,8 @@ lm_base (void) themselves. The declaration of `struct solib' says which fields we provide values for. */ -static owning_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; @@ -594,7 +603,7 @@ dsbt_current_sos (void) break; } - auto &sop = sos.emplace_back (); + auto &sop = sos.emplace_back (*this); auto li = std::make_unique<lm_info_dsbt> (); li->map = loadmap; /* Fetch the name. */ @@ -612,8 +621,8 @@ 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); @@ -630,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); @@ -850,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 (); @@ -864,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); @@ -876,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 ()); @@ -903,26 +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, - nullptr, - nullptr, - nullptr, - nullptr, - default_find_solib_addr, -}; - -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, |