From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 559493858D28 for ; Tue, 10 Oct 2023 20:49:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 559493858D28 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 01DA31E091; Tue, 10 Oct 2023 16:49:46 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 24/24] gdb: rename struct so_list to so Date: Tue, 10 Oct 2023 16:49:29 -0400 Message-ID: <20231010204943.112910-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231010204213.111285-1-simon.marchi@efficios.com> References: <20231010204213.111285-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3496.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_SOFTFAIL,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 so`. Change-Id: I1063061901298bb40fee73bf0cce44cd12154c0e --- gdb/break-catch-load.c | 2 +- gdb/breakpoint.c | 5 ++--- gdb/bsd-uthread.c | 4 ++-- gdb/hppa-tdep.c | 2 +- gdb/hppa-tdep.h | 4 ++-- gdb/interps.c | 4 ++-- gdb/interps.h | 10 ++++----- gdb/mi/mi-cmd-file.c | 2 +- gdb/mi/mi-interp.c | 6 +++--- gdb/mi/mi-interp.h | 6 +++--- gdb/nto-tdep.c | 4 ++-- gdb/nto-tdep.h | 2 +- gdb/observable.h | 6 +++--- gdb/progspace.c | 2 +- gdb/progspace.h | 8 +++---- gdb/solib-aix.c | 12 +++++------ gdb/solib-darwin.c | 10 ++++----- gdb/solib-dsbt.c | 12 +++++------ gdb/solib-frv.c | 14 ++++++------- gdb/solib-rocm.c | 16 +++++++------- gdb/solib-svr4.c | 46 ++++++++++++++++++++--------------------- gdb/solib-target.c | 10 ++++----- gdb/solib.c | 47 +++++++++++++++++++++--------------------- gdb/solib.h | 6 +++--- gdb/solist.h | 16 +++++++------- 25 files changed, 127 insertions(+), 129 deletions(-) diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c index 999de874d5f6..e2d5699f8644 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 (so *iter : current_program_space->added_solibs) { if (!regex || compiled->exec (iter->so_name.c_str (), 0, NULL, 0) == 0) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 3ddd1623cf00..3db76b2ca219 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 (so *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 so &solib) { bool disabled_shlib_breaks = false; diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 8144f8cc64b7..3e8909d4aae2 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 (so &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 so &so) { if (bsd_uthread_solib_name.empty ()) return; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index b7c96e8b050d..233d100400ec 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 */ + so *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 62a5fb8d707e..71d2f4832b15 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 so; /* 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) (so *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 544539b0c798..4ca6317918f4 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 so &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 so &so) { interps_notify (&interp::on_solib_unloaded, so); } diff --git a/gdb/interps.h b/gdb/interps.h index a90c5aa17b0a..a613885ac403 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 so; struct trace_state_variable; typedef struct interp *(*interp_factory_func) (const char *name); @@ -147,10 +147,10 @@ class interp : public intrusive_list_node 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 so &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 so &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 so &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 so &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 adc324e64fc8..e5e21fff366e 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 so &so : current_program_space->solibs ()) { if (so.so_name[0] == '\0') continue; diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 0fae5674201c..f435730e784b 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 so &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 so &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 so &solib) { ui_out *uiout = this->interp_ui_out (); diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h index 781a8dc6f466..76ff459203cc 100644 --- a/gdb/mi/mi-interp.h +++ b/gdb/mi/mi-interp.h @@ -60,8 +60,8 @@ class mi_interp final : public interp 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 so &so) override; + void on_solib_unloaded (const so &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 @@ class mi_interp final : public interp /* 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 so &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 bcc32fd857ed..49b888f753e1 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 so &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 (so &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 8b644b30c42a..322e690ec26b 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 (so &, target_section *); int nto_map_arch_to_cputype (const char *); diff --git a/gdb/observable.h b/gdb/observable.h index 5ed6ca547ce0..37a8cee49698 100644 --- a/gdb/observable.h +++ b/gdb/observable.h @@ -24,7 +24,7 @@ #include "target/waitstatus.h" struct bpstat; -struct so_list; +struct so; 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 4b816b4dac8b..49cccdbd7d5c 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 so &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 0a762e6ad5c8..c5cf975cc8f7 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 so; 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 68798e8735ac..8760c8a730ea 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 so. */ 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 (so &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 so 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; + so *new_solib = new so; std::string so_name; lm_info_aix &info = (*library_list)[ix]; diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 5e3aabbfb831..b2e045642417 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 so element. */ + so *newobj = new so; 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 (so &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 0c60ad69753d..26e6081d9a2a 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 so' 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 so' 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; + so *sop = new so; 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 (so &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 c391462ad9af..6647599b2dd6 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; + so *sop = new so; 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 (so &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 so &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 so &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 so &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 0dc303b5a651..6642db9fbd1c 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 (so &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 so *newobj = new struct so; 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 so' 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 4628c487ff79..aea38d2a6266 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 so &gdb, const so &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 so &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 so &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 so *newobj = new struct so; 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; + so *newobj = new so; 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 so &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 so &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 (so &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 so * 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 so &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 so *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 so *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 so *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 2e1c74f97e70..73ee9166e382 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 so for each entry on the list. */ for (lm_info_target_up &info : library_list) { - so_list *new_solib = new so_list; + so *new_solib = new so; /* 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 (so &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 5272dce6fa4a..15648bd029b7 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 (so &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 () +so::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 (so &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 so &known) { - for (const so_list &pivot : current_program_space->solibs ()) + for (const so &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 (so &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 so &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 (so &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 so' 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 so &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 (so &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 so &so : current_program_space->solibs ()) { if (so.so_name[0]) { @@ -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 so &so : current_program_space->solibs ()) { if (! so.so_name[0]) continue; @@ -1139,8 +1139,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 so &solib, CORE_ADDR address) { for (const target_section &p : solib.sections) if (p.addr <= address && address < p.endaddr) @@ -1163,7 +1162,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 so &so : pspace->so_list) if (solib_contains_address_p (so, address)) return so.so_name.c_str (); @@ -1192,7 +1191,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 ([] (so &so) { notify_solib_unloaded (current_program_space, so); current_program_space->remove_target_sections (&so); @@ -1293,7 +1292,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 (so &so : current_program_space->solibs ()) { const char *found_pathname = NULL; bool was_loaded = so.symbols_loaded != 0; @@ -1700,7 +1699,7 @@ remove_user_added_objfile (struct objfile *objfile) { if (objfile != 0 && objfile->flags & OBJF_USERLOADED) { - for (so_list &so : objfile->pspace->solibs ()) + for (so &so : objfile->pspace->solibs ()) if (so.objfile == objfile) so.objfile = nullptr; } diff --git a/gdb/solib.h b/gdb/solib.h index 88ade882396d..a5854f283f8f 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 so; 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 (so &, 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 so &, 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 4232156c17a7..94fedb79549a 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 so : 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 @@ -52,7 +52,7 @@ struct so_list : intrusive_list_node dynamic linker's tables in the inferior, and are initialized by current_sos. */ - struct so_list *next = nullptr; /* next structure in linked list */ + so *next = nullptr; /* next structure in linked list */ /* A pointer to target specific link map information. Often this will be a copy of struct link_map from the user process, but @@ -99,12 +99,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) (so &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 so &so); /* Free private data structures associated to PSPACE. This method should not free resources associated to individual so_list entries, @@ -119,9 +119,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 so' 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. */ @@ -147,7 +147,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 so &gdb, const so &inferior); /* Return whether a region of memory must be kept in a core file for shared libraries loaded before "gcore" is used to be @@ -172,7 +172,7 @@ struct target_so_ops }; /* A unique pointer to a so_list. */ -using so_list_up = std::unique_ptr; +using so_up = std::unique_ptr; /* Find main executable binary file. */ extern gdb::unique_xmalloc_ptr exec_file_find (const char *in_pathname, -- 2.42.0