From: Simon Marchi Date: Tue, 17 Oct 2023 19:37:58 +0000 (-0400) Subject: gdb: rename struct so_list to shobj X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3fe0dfd1604f9bf8d51a7473f7f27e16242986be;p=binutils-gdb.git gdb: rename struct so_list to shobj Now that so_list lists are implemented using intrusive_list, it doesn't really make sense for the element type to be named "_list". Rename to just `struct shobj` (`struct so` was deemed to be not greppable enough). Change-Id: I1063061901298bb40fee73bf0cce44cd12154c0e Approved-By: Pedro Alves Reviewed-By: Reviewed-By: Lancelot Six --- diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c index 76a7ce538ef..02a98b5d30a 100644 --- a/gdb/break-catch-load.c +++ b/gdb/break-catch-load.c @@ -117,7 +117,7 @@ solib_catchpoint::check_status (struct bpstat *bs) { if (is_load) { - for (so_list *iter : current_program_space->added_solibs) + for (shobj *iter : current_program_space->added_solibs) { if (!regex || compiled->exec (iter->so_name.c_str (), 0, nullptr, 0) == 0) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 3ddd1623cf0..828c99cabc0 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5046,7 +5046,7 @@ print_solib_event (bool is_catchpoint) current_uiout->text (_(" Inferior loaded ")); ui_out_emit_list list_emitter (current_uiout, "added"); bool first = true; - for (so_list *iter : current_program_space->added_solibs) + for (shobj *iter : current_program_space->added_solibs) { if (!first) current_uiout->text (" "); @@ -8018,8 +8018,7 @@ disable_breakpoints_in_shlibs (void) disabled ones can just stay disabled. */ static void -disable_breakpoints_in_unloaded_shlib (program_space *pspace, - const so_list &solib) +disable_breakpoints_in_unloaded_shlib (program_space *pspace, const shobj &solib) { bool disabled_shlib_breaks = false; diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 8144f8cc64b..f3cf5175a81 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -275,7 +275,7 @@ static const char * const bsd_uthread_solib_names[] = }; static void -bsd_uthread_solib_loaded (so_list &so) +bsd_uthread_solib_loaded (shobj &so) { const char * const *names = bsd_uthread_solib_names; @@ -295,7 +295,7 @@ bsd_uthread_solib_loaded (so_list &so) } static void -bsd_uthread_solib_unloaded (program_space *pspace, const so_list &so) +bsd_uthread_solib_unloaded (program_space *pspace, const shobj &so) { if (bsd_uthread_solib_name.empty ()) return; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index b7c96e8b050..c9452a1c96d 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -71,7 +71,7 @@ struct hppa_unwind_info struct hppa_objfile_private { struct hppa_unwind_info *unwind_info = nullptr; /* a pointer */ - struct so_list *so_info = nullptr; /* a pointer */ + shobj *so_info = nullptr; /* a pointer */ CORE_ADDR dp = 0; int dummy_call_sequence_reg = 0; diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h index 62a5fb8d707..bc344388916 100644 --- a/gdb/hppa-tdep.h +++ b/gdb/hppa-tdep.h @@ -24,7 +24,7 @@ struct trad_frame_saved_reg; struct objfile; -struct so_list; +struct shobj; /* Register numbers of various important registers. */ @@ -114,7 +114,7 @@ struct hppa_gdbarch_tdep : gdbarch_tdep_base /* These are solib-dependent methods. They are really HPUX only, but we don't have a HPUX-specific tdep vector at the moment. */ - CORE_ADDR (*solib_thread_start_addr) (struct so_list *so) = nullptr; + CORE_ADDR (*solib_thread_start_addr) (shobj *so) = nullptr; CORE_ADDR (*solib_get_got_by_pc) (CORE_ADDR addr) = nullptr; CORE_ADDR (*solib_get_solib_by_pc) (CORE_ADDR addr) = nullptr; CORE_ADDR (*solib_get_text_base) (struct objfile *objfile) = nullptr; diff --git a/gdb/interps.c b/gdb/interps.c index 2d6edd102d5..2fbf92fa0a2 100644 --- a/gdb/interps.c +++ b/gdb/interps.c @@ -488,7 +488,7 @@ interps_notify_target_resumed (ptid_t ptid) /* See interps.h. */ void -interps_notify_solib_loaded (const so_list &so) +interps_notify_solib_loaded (const shobj &so) { interps_notify (&interp::on_solib_loaded, so); } @@ -496,7 +496,7 @@ interps_notify_solib_loaded (const so_list &so) /* See interps.h. */ void -interps_notify_solib_unloaded (const so_list &so) +interps_notify_solib_unloaded (const shobj &so) { interps_notify (&interp::on_solib_unloaded, so); } diff --git a/gdb/interps.h b/gdb/interps.h index a90c5aa17b0..728155ae81b 100644 --- a/gdb/interps.h +++ b/gdb/interps.h @@ -31,7 +31,7 @@ struct ui; class completion_tracker; struct thread_info; struct inferior; -struct so_list; +struct shobj; struct trace_state_variable; typedef struct interp *(*interp_factory_func) (const char *name); @@ -147,10 +147,10 @@ public: virtual void on_target_resumed (ptid_t ptid) {} /* Notify the interpreter that solib SO has been loaded. */ - virtual void on_solib_loaded (const so_list &so) {} + virtual void on_solib_loaded (const shobj &so) {} /* Notify the interpreter that solib SO has been unloaded. */ - virtual void on_solib_unloaded (const so_list &so) {} + virtual void on_solib_unloaded (const shobj &so) {} /* Notify the interpreter that a command it is executing is about to cause the inferior to proceed. */ @@ -324,10 +324,10 @@ extern void interps_notify_record_changed (inferior *inf, int started, extern void interps_notify_target_resumed (ptid_t ptid); /* Notify all interpreters that solib SO has been loaded. */ -extern void interps_notify_solib_loaded (const so_list &so); +extern void interps_notify_solib_loaded (const shobj &so); /* Notify all interpreters that solib SO has been unloaded. */ -extern void interps_notify_solib_unloaded (const so_list &so); +extern void interps_notify_solib_unloaded (const shobj &so); /* Notify all interpreters that the selected traceframe changed. diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c index b9231b7bd6a..756a50f504d 100644 --- a/gdb/mi/mi-cmd-file.c +++ b/gdb/mi/mi-cmd-file.c @@ -163,7 +163,7 @@ mi_cmd_file_list_shared_libraries (const char *command, /* Print the table header. */ ui_out_emit_list list_emitter (uiout, "shared-libraries"); - for (const so_list &so : current_program_space->solibs ()) + for (const shobj &so : current_program_space->solibs ()) { if (so.so_name.empty ()) continue; diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 0fae5674201..ebd7f150c49 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -724,7 +724,7 @@ mi_interp::on_target_resumed (ptid_t ptid) /* See mi-interp.h. */ void -mi_output_solib_attribs (ui_out *uiout, const so_list &solib) +mi_output_solib_attribs (ui_out *uiout, const shobj &solib) { gdbarch *gdbarch = current_inferior ()->arch (); @@ -745,7 +745,7 @@ mi_output_solib_attribs (ui_out *uiout, const so_list &solib) } void -mi_interp::on_solib_loaded (const so_list &solib) +mi_interp::on_solib_loaded (const shobj &solib) { ui_out *uiout = this->interp_ui_out (); @@ -762,7 +762,7 @@ mi_interp::on_solib_loaded (const so_list &solib) } void -mi_interp::on_solib_unloaded (const so_list &solib) +mi_interp::on_solib_unloaded (const shobj &solib) { ui_out *uiout = this->interp_ui_out (); diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h index 781a8dc6f46..3110c0a6a48 100644 --- a/gdb/mi/mi-interp.h +++ b/gdb/mi/mi-interp.h @@ -60,8 +60,8 @@ public: void on_record_changed (inferior *inf, int started, const char *method, const char *format) override; void on_target_resumed (ptid_t ptid) override; - void on_solib_loaded (const so_list &so) override; - void on_solib_unloaded (const so_list &so) override; + void on_solib_loaded (const shobj &so) override; + void on_solib_unloaded (const shobj &so) override; void on_about_to_proceed () override; void on_traceframe_changed (int tfnum, int tpnum) override; void on_tsv_created (const trace_state_variable *tsv) override; @@ -108,7 +108,7 @@ public: /* Output the shared object attributes to UIOUT. */ -void mi_output_solib_attribs (ui_out *uiout, const so_list &solib); +void mi_output_solib_attribs (ui_out *uiout, const shobj &solib); /* Returns the INTERP's data cast as mi_interp if INTERP is an MI, and returns NULL otherwise. */ diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c index bcc32fd857e..d1f47a2b94e 100644 --- a/gdb/nto-tdep.c +++ b/gdb/nto-tdep.c @@ -245,7 +245,7 @@ nto_parse_redirection (char *pargv[], const char **pin, const char **pout, } static CORE_ADDR -lm_addr (const so_list &so) +lm_addr (const shobj &so) { auto *li = gdb::checked_static_cast (so.lm_info.get ()); @@ -283,7 +283,7 @@ find_load_phdr (bfd *abfd) } void -nto_relocate_section_addresses (so_list &so, target_section *sec) +nto_relocate_section_addresses (shobj &so, target_section *sec) { /* Neutrino treats the l_addr base address field in link.h as different than the base address in the System V ABI and so the offset needs to be diff --git a/gdb/nto-tdep.h b/gdb/nto-tdep.h index 8b644b30c42..b84f6e655ca 100644 --- a/gdb/nto-tdep.h +++ b/gdb/nto-tdep.h @@ -166,7 +166,7 @@ void nto_init_solib_absolute_prefix (void); char **nto_parse_redirection (char *start_argv[], const char **in, const char **out, const char **err); -void nto_relocate_section_addresses (so_list &, target_section *); +void nto_relocate_section_addresses (shobj &, target_section *); int nto_map_arch_to_cputype (const char *); diff --git a/gdb/observable.h b/gdb/observable.h index b7c45922c7b..5869489bcff 100644 --- a/gdb/observable.h +++ b/gdb/observable.h @@ -24,7 +24,7 @@ #include "target/waitstatus.h" struct bpstat; -struct so_list; +struct shobj; struct objfile; struct thread_info; struct inferior; @@ -99,12 +99,12 @@ extern observable solib_loaded; +extern observable solib_loaded; /* The shared library SOLIB has been unloaded from program space PSPACE. Note when gdb calls this observer, the library's symbols have not been unloaded yet, and thus are still available. */ -extern observable solib_unloaded; +extern observable solib_unloaded; /* The symbol file specified by OBJFILE has been loaded. */ extern observable new_objfile; diff --git a/gdb/progspace.c b/gdb/progspace.c index 4b816b4dac8..cca651fdb6f 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -132,7 +132,7 @@ void program_space::free_all_objfiles () { /* Any objfile reference would become stale. */ - for (const struct so_list &so : current_program_space->solibs ()) + for (const shobj &so : current_program_space->solibs ()) gdb_assert (so.objfile == NULL); while (!objfiles_list.empty ()) diff --git a/gdb/progspace.h b/gdb/progspace.h index 0a762e6ad5c..a480f560a77 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -39,7 +39,7 @@ struct inferior; struct exec; struct address_space; struct program_space; -struct so_list; +struct shobj; typedef std::list> objfile_list; @@ -255,7 +255,7 @@ struct program_space struct objfile *objfile_for_address (CORE_ADDR address); /* Return the list of all the solibs in this program space. */ - intrusive_list &solibs () + intrusive_list &solibs () { return so_list; } /* Close and clear exec_bfd. If we end up with no target sections @@ -359,14 +359,14 @@ struct program_space /* List of shared objects mapped into this space. Managed by solib.c. */ - intrusive_list so_list; + intrusive_list so_list; /* Number of calls to solib_add. */ unsigned int solib_add_generation = 0; /* When an solib is added, it is also added to this vector. This is so we can properly report solib changes to the user. */ - std::vector added_solibs; + std::vector added_solibs; /* When an solib is removed, its name is added to this vector. This is so we can properly report solib changes to the user. */ diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index 68798e8735a..c8fa865f49d 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -26,7 +26,7 @@ #include "xcoffread.h" #include "observable.h" -/* Our private data in struct so_list. */ +/* Our private data in struct shobj. */ struct lm_info_aix final : public lm_info { @@ -311,7 +311,7 @@ solib_aix_bss_data_overlap (bfd *abfd) /* Implement the "relocate_section_addresses" target_so_ops method. */ static void -solib_aix_relocate_section_addresses (so_list &so, target_section *sec) +solib_aix_relocate_section_addresses (shobj &so, target_section *sec) { struct bfd_section *bfd_sect = sec->the_bfd_section; bfd *abfd = bfd_sect->owner; @@ -445,7 +445,7 @@ solib_aix_solib_create_inferior_hook (int from_tty) /* Implement the "current_sos" target_so_ops method. */ -static intrusive_list +static intrusive_list solib_aix_current_sos () { gdb::optional> &library_list @@ -453,14 +453,14 @@ solib_aix_current_sos () if (!library_list.has_value ()) return {}; - intrusive_list sos; + intrusive_list sos; - /* Build a struct so_list for each entry on the list. + /* Build a struct shobj for each entry on the list. We skip the first entry, since this is the entry corresponding to the main executable, not a shared library. */ for (int ix = 1; ix < library_list->size (); ix++) { - so_list *new_solib = new so_list; + shobj *new_solib = new shobj; std::string so_name; lm_info_aix &info = (*library_list)[ix]; diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 57e61f9643f..4f9ba9945ce 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -212,7 +212,7 @@ open_symbol_file_object (int from_tty) /* Build a list of currently loaded shared objects. See solib-svr4.c. */ -static intrusive_list +static intrusive_list darwin_current_sos () { type *ptr_type @@ -230,7 +230,7 @@ darwin_current_sos () image_info_size = ptr_len * 3; - intrusive_list sos; + intrusive_list sos; /* Read infos for each solib. The first entry was rumored to be the executable itself, but this is not @@ -271,8 +271,8 @@ darwin_current_sos () if (file_path == nullptr) break; - /* Create and fill the new so_list element. */ - so_list *newobj = new so_list; + /* Create and fill the new struct shobj element. */ + shobj *newobj = new shobj; auto li = gdb::make_unique (); @@ -605,7 +605,7 @@ darwin_clear_solib (program_space *pspace) Relocate these VMAs according to solib info. */ static void -darwin_relocate_section_addresses (so_list &so, target_section *sec) +darwin_relocate_section_addresses (shobj &so, target_section *sec) { auto *li = gdb::checked_static_cast (so.lm_info.get ()); diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index d74ccddada3..65bb6251a0e 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -503,22 +503,22 @@ lm_base (void) } -/* Build a list of `struct so_list' objects describing the shared +/* Build a list of `struct shobj' objects describing the shared objects currently loaded in the inferior. This list does not include an entry for the main executable file. Note that we only gather information directly available from the inferior --- we don't examine any of the shared library files - themselves. The declaration of `struct so_list' says which fields + themselves. The declaration of `struct shobj' says which fields we provide values for. */ -static intrusive_list +static intrusive_list dsbt_current_sos (void) { 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 sos; + intrusive_list sos; /* Make sure that the main executable has been relocated. This is required in order to find the address of the global offset table, @@ -593,7 +593,7 @@ dsbt_current_sos (void) break; } - so_list *sop = new so_list; + shobj *sop = new shobj; auto li = gdb::make_unique (); li->map = loadmap; /* Fetch the name. */ @@ -876,7 +876,7 @@ dsbt_clear_solib (program_space *pspace) } static void -dsbt_relocate_section_addresses (so_list &so, target_section *sec) +dsbt_relocate_section_addresses (shobj &so, target_section *sec) { int seg; auto *li = gdb::checked_static_cast (so.lm_info.get ()); diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index c391462ad9a..0897bce2325 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -306,12 +306,12 @@ lm_base (void) /* Implement the "current_sos" target_so_ops method. */ -static intrusive_list +static intrusive_list frv_current_sos () { bfd_endian byte_order = gdbarch_byte_order (current_inferior ()->arch ()); CORE_ADDR lm_addr, mgot; - intrusive_list sos; + intrusive_list sos; /* Make sure that the main executable has been relocated. This is required in order to find the address of the global offset table, @@ -376,7 +376,7 @@ frv_current_sos () break; } - so_list *sop = new so_list; + shobj *sop = new shobj; auto li = gdb::make_unique (); li->map = loadmap; li->got_value = got_addr; @@ -811,7 +811,7 @@ frv_clear_solib (program_space *pspace) } static void -frv_relocate_section_addresses (so_list &so, target_section *sec) +frv_relocate_section_addresses (shobj &so, target_section *sec) { int seg; auto *li = gdb::checked_static_cast (so.lm_info.get ()); @@ -852,7 +852,7 @@ main_got (void) CORE_ADDR frv_fdpic_find_global_pointer (CORE_ADDR addr) { - for (const so_list &so : current_program_space->solibs ()) + for (const shobj &so : current_program_space->solibs ()) { int seg; auto *li = gdb::checked_static_cast (so.lm_info.get ()); @@ -909,7 +909,7 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point) in list of shared objects. */ if (addr == 0) { - for (const so_list &so : current_program_space->solibs ()) + for (const shobj &so : current_program_space->solibs ()) { auto *li = gdb::checked_static_cast (so.lm_info.get ()); @@ -1061,7 +1061,7 @@ frv_fetch_objfile_link_map (struct objfile *objfile) /* The other link map addresses may be found by examining the list of shared libraries. */ - for (const so_list &so : current_program_space->solibs ()) + for (const shobj &so : current_program_space->solibs ()) { auto *li = gdb::checked_static_cast (so.lm_info.get ()); diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c index 3dc9a068ebe..3a971b3361e 100644 --- a/gdb/solib-rocm.c +++ b/gdb/solib-rocm.c @@ -172,7 +172,7 @@ get_solib_info (inferior *inf) /* Relocate section addresses. */ static void -rocm_solib_relocate_section_addresses (so_list &so, +rocm_solib_relocate_section_addresses (shobj &so, struct target_section *sec) { if (!is_amdgpu_arch (gdbarch_from_bfd (so.abfd.get ()))) @@ -204,14 +204,14 @@ rocm_solib_handle_event () /* Create so_list objects from rocm_so objects in SOS. */ -static intrusive_list +static intrusive_list so_list_from_rocm_sos (const std::vector &sos) { - intrusive_list dst; + intrusive_list dst; for (const rocm_so &so : sos) { - so_list *newobj = new so_list; + struct shobj *newobj = new struct shobj; newobj->lm_info = gdb::make_unique (*so.lm_info); newobj->so_name = so.name; @@ -223,14 +223,14 @@ so_list_from_rocm_sos (const std::vector &sos) return dst; } -/* Build a list of `struct so_list' objects describing the shared +/* Build a list of `struct shobj' objects describing the shared objects currently loaded in the inferior. */ -static intrusive_list +static intrusive_list rocm_solib_current_sos () { /* First, retrieve the host-side shared library list. */ - intrusive_list sos = svr4_so_ops.current_sos (); + intrusive_list sos = svr4_so_ops.current_sos (); /* Then, the device-side shared library list. */ std::vector &dev_sos = get_solib_info (current_inferior ())->solib_list; @@ -238,7 +238,7 @@ rocm_solib_current_sos () if (dev_sos.empty ()) return sos; - intrusive_list dev_so_list = so_list_from_rocm_sos (dev_sos); + intrusive_list dev_so_list = so_list_from_rocm_sos (dev_sos); if (sos.empty ()) return dev_so_list; diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 4628c487ff7..e21190a30f1 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -186,7 +186,7 @@ svr4_same (const char *gdb_name, const char *inferior_name, } static int -svr4_same (const so_list &gdb, const so_list &inferior) +svr4_same (const shobj &gdb, const shobj &inferior) { auto *lmg = gdb::checked_static_cast (gdb.lm_info.get ()); @@ -239,7 +239,7 @@ has_lm_dynamic_from_link_map (void) } static CORE_ADDR -lm_addr_check (const so_list &so, bfd *abfd) +lm_addr_check (const shobj &so, bfd *abfd) { auto *li = gdb::checked_static_cast (so.lm_info.get ()); @@ -980,7 +980,7 @@ svr4_free_objfile_observer (struct objfile *objfile) /* Implement target_so_ops.clear_so. */ static void -svr4_clear_so (const so_list &so) +svr4_clear_so (const shobj &so) { auto *li = gdb::checked_static_cast (so.lm_info.get ()); @@ -990,14 +990,14 @@ svr4_clear_so (const so_list &so) /* Create the so_list objects equivalent to the svr4_sos in SOS. */ -static intrusive_list +static intrusive_list so_list_from_svr4_sos (const std::vector &sos) { - intrusive_list dst; + intrusive_list dst; for (const svr4_so &so : sos) { - so_list *newobj = new so_list; + struct shobj *newobj = new struct shobj; newobj->so_name = so.name; newobj->so_original_name = so.name; @@ -1183,13 +1183,13 @@ svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list, /* If no shared library information is available from the dynamic linker, build a fallback list from other sources. */ -static intrusive_list +static intrusive_list svr4_default_sos (svr4_info *info) { if (!info->debug_loader_offset_p) return {}; - so_list *newobj = new so_list; + shobj *newobj = new shobj; auto li = gdb::make_unique (); /* Nothing will ever check the other fields if we set l_addr_p. */ @@ -1200,7 +1200,7 @@ svr4_default_sos (svr4_info *info) newobj->so_name = info->debug_loader_name; newobj->so_original_name = newobj->so_name; - intrusive_list sos; + intrusive_list sos; sos.push_back (*newobj); return sos; @@ -1372,10 +1372,10 @@ svr4_current_sos_direct (struct svr4_info *info) /* Collect sos read and stored by the probes interface. */ -static intrusive_list +static intrusive_list svr4_collect_probes_sos (svr4_info *info) { - intrusive_list res; + intrusive_list res; for (const auto &tuple : info->solib_lists) { @@ -1389,10 +1389,10 @@ svr4_collect_probes_sos (svr4_info *info) /* Implement the main part of the "current_sos" target_so_ops method. */ -static intrusive_list +static intrusive_list svr4_current_sos_1 (svr4_info *info) { - intrusive_list sos; + intrusive_list sos; /* If we're using the probes interface, we can use the cache as it will be maintained by probe update/reload actions. */ @@ -1416,11 +1416,11 @@ svr4_current_sos_1 (svr4_info *info) /* Implement the "current_sos" target_so_ops method. */ -static intrusive_list +static intrusive_list svr4_current_sos () { svr4_info *info = get_svr4_info (current_program_space); - intrusive_list sos = svr4_current_sos_1 (info); + intrusive_list sos = svr4_current_sos_1 (info); struct mem_range vsyscall_range; /* Filter out the vDSO module, if present. Its symbol file would @@ -1507,7 +1507,7 @@ svr4_fetch_objfile_link_map (struct objfile *objfile) /* The other link map addresses may be found by examining the list of shared libraries. */ - for (const so_list &so : current_program_space->solibs ()) + for (const shobj &so : current_program_space->solibs ()) if (so.objfile == objfile) { auto *li @@ -2348,7 +2348,7 @@ enable_break (struct svr4_info *info, int from_tty) /* On a running target, we can get the dynamic linker's base address from the shared library table. */ - for (const so_list &so : current_program_space->solibs ()) + for (const shobj &so : current_program_space->solibs ()) { if (svr4_same_1 (interp_name, so.so_original_name.c_str ())) { @@ -3097,7 +3097,7 @@ svr4_truncate_ptr (CORE_ADDR addr) static void -svr4_relocate_section_addresses (so_list &so, target_section *sec) +svr4_relocate_section_addresses (shobj &so, target_section *sec) { bfd *abfd = sec->the_bfd_section->owner; @@ -3238,7 +3238,7 @@ svr4_lp64_fetch_link_map_offsets (void) /* Return the DSO matching OBJFILE or nullptr if none can be found. */ -static const so_list * +static const shobj * find_solib_for_objfile (struct objfile *objfile) { if (objfile == nullptr) @@ -3249,7 +3249,7 @@ find_solib_for_objfile (struct objfile *objfile) if (objfile->separate_debug_objfile_backlink != nullptr) objfile = objfile->separate_debug_objfile_backlink; - for (const so_list &so : current_program_space->solibs ()) + for (const shobj &so : current_program_space->solibs ()) if (so.objfile == objfile) return &so; @@ -3264,7 +3264,7 @@ find_solib_for_objfile (struct objfile *objfile) right thing for the main executable. */ static CORE_ADDR -find_debug_base_for_solib (const so_list *solib) +find_debug_base_for_solib (const shobj *solib) { if (solib == nullptr) return 0; @@ -3325,7 +3325,7 @@ svr4_iterate_over_objfiles_in_search_order /* The linker namespace to iterate identified by the address of its r_debug object, defaulting to the initial namespace. */ CORE_ADDR initial = elf_locate_base (); - const so_list *curr_solib = find_solib_for_objfile (current_objfile); + const shobj *curr_solib = find_solib_for_objfile (current_objfile); CORE_ADDR debug_base = find_debug_base_for_solib (curr_solib); if (debug_base == 0) debug_base = initial; @@ -3340,7 +3340,7 @@ svr4_iterate_over_objfiles_in_search_order If we fail, e.g. for manually added symbol files or for the main executable, we assume that they were added to the initial namespace. */ - const so_list *solib = find_solib_for_objfile (objfile); + const shobj *solib = find_solib_for_objfile (objfile); CORE_ADDR solib_base = find_debug_base_for_solib (solib); if (solib_base == 0) solib_base = initial; diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 2e1c74f97e7..e93fe8e7d54 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -227,10 +227,10 @@ solib_target_parse_libraries (const char *library) } #endif -static intrusive_list +static intrusive_list solib_target_current_sos (void) { - intrusive_list sos; + intrusive_list sos; /* Fetch the list of shared libraries. */ gdb::optional library_document @@ -243,10 +243,10 @@ solib_target_current_sos (void) std::vector library_list = solib_target_parse_libraries (library_document->data ()); - /* Build a struct so_list for each entry on the list. */ + /* Build a struct shobj for each entry on the list. */ for (lm_info_target_up &info : library_list) { - so_list *new_solib = new so_list; + shobj *new_solib = new shobj; /* We don't need a copy of the name in INFO anymore. */ new_solib->so_name = std::move (info->name); @@ -267,7 +267,7 @@ solib_target_solib_create_inferior_hook (int from_tty) } static void -solib_target_relocate_section_addresses (so_list &so, target_section *sec) +solib_target_relocate_section_addresses (shobj &so, target_section *sec) { CORE_ADDR offset; auto *li = gdb::checked_static_cast (so.lm_info.get ()); diff --git a/gdb/solib.c b/gdb/solib.c index a137fbbd123..71970636dc5 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -539,7 +539,7 @@ get_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname) expansion stuff?). */ static int -solib_map_sections (so_list &so) +solib_map_sections (shobj &so) { const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); @@ -626,7 +626,7 @@ solib_map_sections (so_list &so) /* See solist.h. */ void -so_list::clear () +shobj::clear () { const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); @@ -654,7 +654,7 @@ lm_info::~lm_info () = default; be chatty about it. Return true if any symbols were actually loaded. */ bool -solib_read_symbols (so_list &so, symfile_add_flags flags) +solib_read_symbols (shobj &so, symfile_add_flags flags) { if (so.symbols_loaded) { @@ -715,9 +715,9 @@ solib_read_symbols (so_list &so, symfile_add_flags flags) in the list of shared libraries. Return false otherwise. */ static bool -solib_used (const so_list &known) +solib_used (const shobj &known) { - for (const so_list &pivot : current_program_space->solibs ()) + for (const shobj &pivot : current_program_space->solibs ()) if (&pivot != &known && pivot.objfile == known.objfile) return true; return false; @@ -726,7 +726,7 @@ solib_used (const so_list &known) /* Notify interpreters and observers that solib SO has been loaded. */ static void -notify_solib_loaded (so_list &so) +notify_solib_loaded (shobj &so) { interps_notify_solib_loaded (so); gdb::observers::solib_loaded.notify (so); @@ -735,7 +735,7 @@ notify_solib_loaded (so_list &so) /* Notify interpreters and observers that solib SO has been unloaded. */ static void -notify_solib_unloaded (program_space *pspace, const so_list &so) +notify_solib_unloaded (program_space *pspace, const shobj &so) { interps_notify_solib_unloaded (so); gdb::observers::solib_unloaded.notify (pspace, so); @@ -797,12 +797,12 @@ update_solib_list (int from_tty) the time we're done walking GDB's list, the inferior's list contains only the new shared objects, which we then add. */ - intrusive_list inferior = ops->current_sos (); - intrusive_list::iterator gdb_iter + intrusive_list inferior = ops->current_sos (); + intrusive_list::iterator gdb_iter = current_program_space->so_list.begin (); while (gdb_iter != current_program_space->so_list.end ()) { - intrusive_list::iterator inferior_iter = inferior.begin (); + intrusive_list::iterator inferior_iter = inferior.begin (); /* Check to see whether the shared object *gdb also appears in the inferior's current list. */ @@ -840,7 +840,7 @@ update_solib_list (int from_tty) current_program_space->deleted_solibs.push_back (gdb_iter->so_name); - intrusive_list::iterator gdb_iter_next + intrusive_list::iterator gdb_iter_next = current_program_space->so_list.erase (gdb_iter); /* Unless the user loaded it explicitly, free SO's objfile. */ @@ -866,14 +866,14 @@ update_solib_list (int from_tty) int not_found = 0; const char *not_found_filename = NULL; - /* Fill in the rest of each of the `struct so_list' nodes. */ - for (so_list &new_so : inferior) + /* Fill in the rest of each of the `so' nodes. */ + for (shobj &new_so : inferior) { current_program_space->added_solibs.push_back (&new_so); try { - /* Fill in the rest of the `struct so_list' node. */ + /* Fill in the rest of the `struct shobj' node. */ if (!solib_map_sections (new_so)) { not_found++; @@ -939,7 +939,7 @@ libpthread_name_p (const char *name) /* Return non-zero if SO is the libpthread shared library. */ static bool -libpthread_solib_p (const so_list &so) +libpthread_solib_p (const shobj &so) { return libpthread_name_p (so.so_name.c_str ()); } @@ -990,7 +990,7 @@ solib_add (const char *pattern, int from_tty, int readsyms) if (from_tty) add_flags |= SYMFILE_VERBOSE; - for (so_list &gdb : current_program_space->solibs ()) + for (shobj &gdb : current_program_space->solibs ()) if (! pattern || re_exec (gdb.so_name.c_str ())) { /* Normally, we would read the symbols from that library @@ -1064,7 +1064,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty) so we need to make two passes over the libs. */ nr_libs = 0; - for (const so_list &so : current_program_space->solibs ()) + for (const shobj &so : current_program_space->solibs ()) { if (!so.so_name.empty ()) { @@ -1085,7 +1085,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty) uiout->table_body (); - for (const so_list &so : current_program_space->solibs ()) + for (const shobj &so : current_program_space->solibs ()) { if (so.so_name.empty ()) continue; @@ -1140,8 +1140,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty) /* See solib.h. */ bool -solib_contains_address_p (const so_list &solib, - CORE_ADDR address) +solib_contains_address_p (const shobj &solib, CORE_ADDR address) { for (const target_section &p : solib.sections) if (p.addr <= address && address < p.endaddr) @@ -1164,7 +1163,7 @@ solib_contains_address_p (const so_list &solib, const char * solib_name_from_address (struct program_space *pspace, CORE_ADDR address) { - for (const so_list &so : pspace->so_list) + for (const shobj &so : pspace->so_list) if (solib_contains_address_p (so, address)) return so.so_name.c_str (); @@ -1193,7 +1192,7 @@ clear_solib (void) disable_breakpoints_in_shlibs (); - current_program_space->so_list.clear_and_dispose ([] (so_list *so) + current_program_space->so_list.clear_and_dispose ([] (shobj *so) { notify_solib_unloaded (current_program_space, *so); current_program_space->remove_target_sections (&so); @@ -1294,7 +1293,7 @@ reload_shared_libraries_1 (int from_tty) if (print_symbol_loading_p (from_tty, 0, 0)) gdb_printf (_("Loading symbols for shared libraries.\n")); - for (so_list &so : current_program_space->solibs ()) + for (shobj &so : current_program_space->solibs ()) { const char *found_pathname = NULL; bool was_loaded = so.symbols_loaded != 0; @@ -1701,7 +1700,7 @@ remove_user_added_objfile (struct objfile *objfile) { if (objfile != 0 && objfile->flags & OBJF_USERLOADED) { - for (so_list &so : objfile->pspace->solibs ()) + for (shobj &so : objfile->pspace->solibs ()) if (so.objfile == objfile) so.objfile = nullptr; } diff --git a/gdb/solib.h b/gdb/solib.h index 88ade882396..d6d343e21a0 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -21,7 +21,7 @@ #define SOLIB_H /* Forward decl's for prototypes */ -struct so_list; +struct shobj; struct target_ops; struct target_so_ops; struct program_space; @@ -50,7 +50,7 @@ extern void clear_solib (void); /* Called to add symbols from a shared library to gdb's symbol table. */ extern void solib_add (const char *, int, int); -extern bool solib_read_symbols (so_list &, symfile_add_flags); +extern bool solib_read_symbols (shobj &, symfile_add_flags); /* Function to be called when the inferior starts up, to discover the names of shared libraries that are dynamically linked, the base @@ -65,7 +65,7 @@ extern const char *solib_name_from_address (struct program_space *, CORE_ADDR); /* Return true if ADDR lies within SOLIB. */ -extern bool solib_contains_address_p (const so_list &, CORE_ADDR); +extern bool solib_contains_address_p (const shobj &, CORE_ADDR); /* Return whether the data starting at VADDR, size SIZE, must be kept in a core file for shared libraries loaded before "gcore" is used diff --git a/gdb/solist.h b/gdb/solist.h index c9ab49a6075..fb61ebea01b 100644 --- a/gdb/solist.h +++ b/gdb/solist.h @@ -36,7 +36,7 @@ struct lm_info using lm_info_up = std::unique_ptr; -struct so_list : intrusive_list_node +struct shobj : intrusive_list_node { /* Free symbol-file related contents of SO and reset for possible reloading of SO. If we have opened a BFD for SO, close it. If we have placed SO's @@ -97,12 +97,12 @@ struct target_so_ops { /* Adjust the section binding addresses by the base address at which the object was actually mapped. */ - void (*relocate_section_addresses) (so_list &so, target_section *); + void (*relocate_section_addresses) (shobj &so, target_section *); /* Reset private data structures associated with SO. This is called when SO is about to be reloaded. It is also called when SO is about to be freed. */ - void (*clear_so) (const so_list &so); + void (*clear_so) (const shobj &so); /* Free private data structures associated to PSPACE. This method should not free resources associated to individual so_list entries, @@ -117,9 +117,9 @@ struct target_so_ops Note that we only gather information directly available from the inferior --- we don't examine any of the shared library files - themselves. The declaration of `struct so_list' says which fields + themselves. The declaration of `struct shobj' says which fields we provide values for. */ - intrusive_list (*current_sos) (); + intrusive_list (*current_sos) (); /* Find, open, and read the symbols for the main executable. If FROM_TTY is non-zero, allow messages to be printed. */ @@ -145,7 +145,7 @@ struct target_so_ops if they represent the same library. Falls back to using strcmp on so_original_name field when set to NULL. */ - int (*same) (const so_list &gdb, const so_list &inferior); + int (*same) (const shobj &gdb, const shobj &inferior); /* Return whether a region of memory must be kept in a core file for shared libraries loaded before "gcore" is used to be @@ -170,7 +170,7 @@ struct target_so_ops }; /* A unique pointer to a so_list. */ -using so_list_up = std::unique_ptr; +using shobj_up = std::unique_ptr; /* Find main executable binary file. */ extern gdb::unique_xmalloc_ptr exec_file_find (const char *in_pathname,