From patchwork Mon Feb 5 20:18:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 85319 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 798103857B86 for ; Mon, 5 Feb 2024 20:20:34 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 3E0D43858C29 for ; Mon, 5 Feb 2024 20:19:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3E0D43858C29 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3E0D43858C29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707164403; cv=none; b=Wfek2MYpHnX58ua+Sl0Kwvv/hsn+sjXz22i16fMYT/XigCGY2BTHKsOUnDUOO5RvwP0xt1bfBWiLQ770jDWxXeNt6pndQTU266YWUzJt7UN9N3ZWqAmJgbdBAl/iTBgn56NzAl2Vtq/ZrTqHySW8OKVJdIrJgkpgqYD3L9uPDOs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707164403; c=relaxed/simple; bh=2bm41jMWomGmtwG5ecMgdnBe0E3Csl5s6bWr5gKMF1E=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Fk5RvH1yIHZu5Pb/QJRGGBZy5uaEmAvbkR5YudxYDnQ11ZbdRI16q10YAsaaZcVvGTWpPzRISUrPpTxOcMqOTshwA1My3yo0UAdr/f86ycX1V07zMNpAxN+waAry7HlK5wqiDV0VIfbKfAhxfwcp930ADF3pawETWQ6cUTUOgw8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (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 57BF41E0C2; Mon, 5 Feb 2024 15:19:56 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/2] gdb: rename struct shobj -> struct solib Date: Mon, 5 Feb 2024 15:18:33 -0500 Message-ID: <20240205201954.122492-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240205201954.122492-1-simon.marchi@efficios.com> References: <20240205201954.122492-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1173.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org `struct so_list` was recently renamed to `struct shobj` (in 3fe0dfd1604f ("gdb: rename struct so_list to shobj")). In hindsight, `solib` would have been a better name. We have solib.c, the implementations in solib-*.c, many functions with solib in their name, the solib_loaded / solib_unloaded observables, etc. Rename shobj to solib. Change-Id: I0af1c7a9b29bdda027e9af633f6d37e1cfcacd5d --- gdb/break-catch-load.c | 2 +- gdb/breakpoint.c | 4 ++-- 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 | 44 ++++++++++++++++++++-------------------- gdb/solib.h | 6 +++--- gdb/solist.h | 14 ++++++------- gdb/target-section.h | 8 ++++---- 26 files changed, 129 insertions(+), 129 deletions(-) diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c index b2106ac84de8..9582a7ccaad4 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 (shobj *iter : current_program_space->added_solibs) + for (solib *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 1173b6e3d602..7d1171ec35eb 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5044,7 +5044,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 (shobj *iter : current_program_space->added_solibs) + for (solib *iter : current_program_space->added_solibs) { if (!first) current_uiout->text (" "); @@ -8019,7 +8019,7 @@ disable_breakpoints_in_shlibs (void) disabled ones can just stay disabled. */ static void -disable_breakpoints_in_unloaded_shlib (program_space *pspace, const shobj &solib) +disable_breakpoints_in_unloaded_shlib (program_space *pspace, const solib &solib) { bool disabled_shlib_breaks = false; diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 5a4c84d7ce69..10e2ca5939e7 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 (shobj &so) +bsd_uthread_solib_loaded (solib &so) { const char * const *names = bsd_uthread_solib_names; @@ -295,7 +295,7 @@ bsd_uthread_solib_loaded (shobj &so) } static void -bsd_uthread_solib_unloaded (program_space *pspace, const shobj &so) +bsd_uthread_solib_unloaded (program_space *pspace, const solib &so) { if (bsd_uthread_solib_name.empty ()) return; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 76e13a6b52f3..32e46b831cbc 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 */ - shobj *so_info = nullptr; /* a pointer */ + solib *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 b0b68f820c8e..2372dd6dd12d 100644 --- a/gdb/hppa-tdep.h +++ b/gdb/hppa-tdep.h @@ -24,7 +24,7 @@ struct trad_frame_saved_reg; struct objfile; -struct shobj; +struct solib; /* 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) (shobj *so) = nullptr; + CORE_ADDR (*solib_thread_start_addr) (solib *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 391fea1da038..8e9570ecb1eb 100644 --- a/gdb/interps.c +++ b/gdb/interps.c @@ -487,7 +487,7 @@ interps_notify_target_resumed (ptid_t ptid) /* See interps.h. */ void -interps_notify_solib_loaded (const shobj &so) +interps_notify_solib_loaded (const solib &so) { interps_notify (&interp::on_solib_loaded, so); } @@ -495,7 +495,7 @@ interps_notify_solib_loaded (const shobj &so) /* See interps.h. */ void -interps_notify_solib_unloaded (const shobj &so) +interps_notify_solib_unloaded (const solib &so) { interps_notify (&interp::on_solib_unloaded, so); } diff --git a/gdb/interps.h b/gdb/interps.h index b602e0e20ce1..bd435d734afc 100644 --- a/gdb/interps.h +++ b/gdb/interps.h @@ -31,7 +31,7 @@ struct ui; class completion_tracker; struct thread_info; struct inferior; -struct shobj; +struct solib; 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 shobj &so) {} + virtual void on_solib_loaded (const solib &so) {} /* Notify the interpreter that solib SO has been unloaded. */ - virtual void on_solib_unloaded (const shobj &so) {} + virtual void on_solib_unloaded (const solib &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 shobj &so); +extern void interps_notify_solib_loaded (const solib &so); /* Notify all interpreters that solib SO has been unloaded. */ -extern void interps_notify_solib_unloaded (const shobj &so); +extern void interps_notify_solib_unloaded (const solib &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 91e5272ac782..95128a9ad6dc 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 shobj &so : current_program_space->solibs ()) + for (const solib &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 21d530554c76..38ae22769015 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 shobj &solib) +mi_output_solib_attribs (ui_out *uiout, const solib &solib) { gdbarch *gdbarch = current_inferior ()->arch (); @@ -745,7 +745,7 @@ mi_output_solib_attribs (ui_out *uiout, const shobj &solib) } void -mi_interp::on_solib_loaded (const shobj &solib) +mi_interp::on_solib_loaded (const solib &solib) { ui_out *uiout = this->interp_ui_out (); @@ -762,7 +762,7 @@ mi_interp::on_solib_loaded (const shobj &solib) } void -mi_interp::on_solib_unloaded (const shobj &solib) +mi_interp::on_solib_unloaded (const solib &solib) { ui_out *uiout = this->interp_ui_out (); diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h index 9bb6b95031fb..cd48fcf0aa15 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 shobj &so) override; - void on_solib_unloaded (const shobj &so) override; + void on_solib_loaded (const solib &so) override; + void on_solib_unloaded (const solib &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 shobj &solib); +void mi_output_solib_attribs (ui_out *uiout, const solib &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 a86d3e7b784c..a16459283f50 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 shobj &so) +lm_addr (const solib &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 (shobj &so, target_section *sec) +nto_relocate_section_addresses (solib &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 7289d6adc575..249a4f631fe6 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 (shobj &, target_section *); +void nto_relocate_section_addresses (solib &, target_section *); int nto_map_arch_to_cputype (const char *); diff --git a/gdb/observable.h b/gdb/observable.h index 963af57eba20..0e9226982772 100644 --- a/gdb/observable.h +++ b/gdb/observable.h @@ -24,7 +24,7 @@ #include "target/waitstatus.h" struct bpstat; -struct shobj; +struct solib; 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 cc17da3e1d65..cda0f415a3fd 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -130,7 +130,7 @@ void program_space::free_all_objfiles () { /* Any objfile reference would become stale. */ - for (const shobj &so : current_program_space->solibs ()) + for (const solib &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 cf24ba73364e..e3ade5101f94 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -41,7 +41,7 @@ struct inferior; struct exec; struct address_space; struct program_space; -struct shobj; +struct solib; typedef std::list> objfile_list; @@ -291,7 +291,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 @@ -395,14 +395,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 dfde05ad9819..70bfe258e678 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 shobj. */ +/* Our private data in struct solib. */ 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 (shobj &so, target_section *sec) +solib_aix_relocate_section_addresses (solib &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 () { std::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 shobj for each entry on the list. + /* Build a struct solib 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++) { - shobj *new_solib = new shobj; + solib *new_solib = new solib; std::string so_name; lm_info_aix &info = (*library_list)[ix]; diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 707e389988f6..27d4546e5774 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 struct shobj element. */ - shobj *newobj = new shobj; + /* Create and fill the new struct solib element. */ + solib *newobj = new solib; auto li = std::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 (shobj &so, target_section *sec) +darwin_relocate_section_addresses (solib &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 813b9d1178b9..d90bb7510a30 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -503,22 +503,22 @@ lm_base (void) } -/* Build a list of `struct shobj' objects describing the shared +/* Build a list of `struct solib' 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 shobj' says which fields + themselves. The declaration of `struct solib' 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; } - shobj *sop = new shobj; + solib *sop = new solib; auto li = std::make_unique (); li->map = loadmap; /* Fetch the name. */ @@ -876,7 +876,7 @@ dsbt_clear_solib (program_space *pspace) } static void -dsbt_relocate_section_addresses (shobj &so, target_section *sec) +dsbt_relocate_section_addresses (solib &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 dd6785c4bdaf..9a098f7943f2 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; } - shobj *sop = new shobj; + solib *sop = new solib; auto li = std::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 (shobj &so, target_section *sec) +frv_relocate_section_addresses (solib &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 shobj &so : current_program_space->solibs ()) + for (const solib &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 shobj &so : current_program_space->solibs ()) + for (const solib &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 shobj &so : current_program_space->solibs ()) + for (const solib &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 58689a315292..f4538c1540bb 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 (shobj &so, +rocm_solib_relocate_section_addresses (solib &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) { - struct shobj *newobj = new struct shobj; + solib *newobj = new solib; newobj->lm_info = std::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 shobj' objects describing the shared +/* Build a list of `struct solib' 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 45d1d5f5d13a..eb726a203af6 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 shobj &gdb, const shobj &inferior) +svr4_same (const solib &gdb, const solib &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 shobj &so, bfd *abfd) +lm_addr_check (const solib &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 shobj &so) +svr4_clear_so (const solib &so) { auto *li = gdb::checked_static_cast (so.lm_info.get ()); @@ -990,14 +990,14 @@ svr4_clear_so (const shobj &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) { - struct shobj *newobj = new struct shobj; + struct solib *newobj = new struct solib; 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 {}; - shobj *newobj = new shobj; + solib *newobj = new solib; auto li = std::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 shobj &so : current_program_space->solibs ()) + for (const solib &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 shobj &so : current_program_space->solibs ()) + for (const solib &so : current_program_space->solibs ()) { if (svr4_same_1 (interp_name, so.so_original_name.c_str ())) { @@ -3096,7 +3096,7 @@ svr4_truncate_ptr (CORE_ADDR addr) static void -svr4_relocate_section_addresses (shobj &so, target_section *sec) +svr4_relocate_section_addresses (solib &so, target_section *sec) { bfd *abfd = sec->the_bfd_section->owner; @@ -3237,7 +3237,7 @@ svr4_lp64_fetch_link_map_offsets (void) /* Return the DSO matching OBJFILE or nullptr if none can be found. */ -static const shobj * +static const solib * find_solib_for_objfile (struct objfile *objfile) { if (objfile == nullptr) @@ -3248,7 +3248,7 @@ find_solib_for_objfile (struct objfile *objfile) if (objfile->separate_debug_objfile_backlink != nullptr) objfile = objfile->separate_debug_objfile_backlink; - for (const shobj &so : current_program_space->solibs ()) + for (const solib &so : current_program_space->solibs ()) if (so.objfile == objfile) return &so; @@ -3263,7 +3263,7 @@ find_solib_for_objfile (struct objfile *objfile) right thing for the main executable. */ static CORE_ADDR -find_debug_base_for_solib (const shobj *solib) +find_debug_base_for_solib (const solib *solib) { if (solib == nullptr) return 0; @@ -3324,7 +3324,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 shobj *curr_solib = find_solib_for_objfile (current_objfile); + const solib *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; @@ -3339,7 +3339,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 shobj *solib = find_solib_for_objfile (objfile); + const solib *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 ef2bf82f0a41..5e46adcf224a 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. */ std::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 shobj for each entry on the list. */ + /* Build a struct solib for each entry on the list. */ for (lm_info_target_up &info : library_list) { - shobj *new_solib = new shobj; + solib *new_solib = new solib; /* 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 (shobj &so, target_section *sec) +solib_target_relocate_section_addresses (solib &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 d33880a54e7a..be9ec3dde37f 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 (shobj &so) +solib_map_sections (solib &so) { const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); @@ -626,7 +626,7 @@ solib_map_sections (shobj &so) /* See solist.h. */ void -shobj::clear () +solib::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 (shobj &so, symfile_add_flags flags) +solib_read_symbols (solib &so, symfile_add_flags flags) { if (so.symbols_loaded) { @@ -715,9 +715,9 @@ solib_read_symbols (shobj &so, symfile_add_flags flags) in the list of shared libraries. Return false otherwise. */ static bool -solib_used (const shobj &known) +solib_used (const solib &known) { - for (const shobj &pivot : current_program_space->solibs ()) + for (const solib &pivot : current_program_space->solibs ()) if (&pivot != &known && pivot.objfile == known.objfile) return true; return false; @@ -726,7 +726,7 @@ solib_used (const shobj &known) /* Notify interpreters and observers that solib SO has been loaded. */ static void -notify_solib_loaded (shobj &so) +notify_solib_loaded (solib &so) { interps_notify_solib_loaded (so); gdb::observers::solib_loaded.notify (so); @@ -735,7 +735,7 @@ notify_solib_loaded (shobj &so) /* Notify interpreters and observers that solib SO has been unloaded. */ static void -notify_solib_unloaded (program_space *pspace, const shobj &so) +notify_solib_unloaded (program_space *pspace, const solib &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. */ @@ -867,13 +867,13 @@ update_solib_list (int from_tty) const char *not_found_filename = NULL; /* Fill in the rest of each of the `so' nodes. */ - for (shobj &new_so : inferior) + for (solib &new_so : inferior) { current_program_space->added_solibs.push_back (&new_so); try { - /* Fill in the rest of the `struct shobj' node. */ + /* Fill in the rest of the `struct solib' 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 shobj &so) +libpthread_solib_p (const solib &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 (shobj &gdb : current_program_space->solibs ()) + for (solib &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 shobj &so : current_program_space->solibs ()) + for (const solib &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 shobj &so : current_program_space->solibs ()) + for (const solib &so : current_program_space->solibs ()) { if (so.so_name.empty ()) continue; @@ -1140,7 +1140,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty) /* See solib.h. */ bool -solib_contains_address_p (const shobj &solib, CORE_ADDR address) +solib_contains_address_p (const solib &solib, CORE_ADDR address) { for (const target_section &p : solib.sections) if (p.addr <= address && address < p.endaddr) @@ -1163,7 +1163,7 @@ solib_contains_address_p (const shobj &solib, CORE_ADDR address) const char * solib_name_from_address (struct program_space *pspace, CORE_ADDR address) { - for (const shobj &so : pspace->so_list) + for (const solib &so : pspace->so_list) if (solib_contains_address_p (so, address)) return so.so_name.c_str (); @@ -1192,7 +1192,7 @@ clear_solib (void) disable_breakpoints_in_shlibs (); - current_program_space->so_list.clear_and_dispose ([] (shobj *so) + current_program_space->so_list.clear_and_dispose ([] (solib *so) { notify_solib_unloaded (current_program_space, *so); current_program_space->remove_target_sections (so); @@ -1293,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 (shobj &so : current_program_space->solibs ()) + for (solib &so : current_program_space->solibs ()) { const char *found_pathname = NULL; bool was_loaded = so.symbols_loaded != 0; @@ -1702,7 +1702,7 @@ remove_user_added_objfile (struct objfile *objfile) { if (objfile != 0 && objfile->flags & OBJF_USERLOADED) { - for (shobj &so : objfile->pspace->solibs ()) + for (solib &so : objfile->pspace->solibs ()) if (so.objfile == objfile) so.objfile = nullptr; } diff --git a/gdb/solib.h b/gdb/solib.h index 0fb47e014509..d267e3fefa47 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -21,7 +21,7 @@ #define SOLIB_H /* Forward decl's for prototypes */ -struct shobj; +struct solib; 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 (shobj &, symfile_add_flags); +extern bool solib_read_symbols (solib &, 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 shobj &, CORE_ADDR); +extern bool solib_contains_address_p (const solib &, 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 6e93d0ff0174..b485d3748800 100644 --- a/gdb/solist.h +++ b/gdb/solist.h @@ -36,7 +36,7 @@ struct lm_info using lm_info_up = std::unique_ptr; -struct shobj : intrusive_list_node +struct solib : 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) (shobj &so, target_section *); + void (*relocate_section_addresses) (solib &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 shobj &so); + void (*clear_so) (const solib &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 shobj' says which fields + themselves. The declaration of `struct solib' 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 shobj &gdb, const shobj &inferior); + int (*same) (const solib &gdb, const solib &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 shobj_up = std::unique_ptr; +using solib_up = std::unique_ptr; /* Find main executable binary file. */ extern gdb::unique_xmalloc_ptr exec_file_find (const char *in_pathname, diff --git a/gdb/target-section.h b/gdb/target-section.h index 151145bf4f97..d7cea4f5f015 100644 --- a/gdb/target-section.h +++ b/gdb/target-section.h @@ -22,7 +22,7 @@ struct bfd; struct objfile; -struct shobj; +struct solib; /* A union representing the possible owner types of a target_section. */ @@ -31,7 +31,7 @@ union target_section_owner target_section_owner () : m_v (nullptr) {} target_section_owner (const bfd *bfd) : bfd (bfd) {} target_section_owner (const objfile *objfile) : objfile (objfile) {} - target_section_owner (const shobj *shobj) : shobj (shobj) {} + target_section_owner (const solib *solib) : solib (solib) {} /* Use this to access the type-erased version of the owner, for comparisons, printing, etc. We don't access the M_V member @@ -46,7 +46,7 @@ union target_section_owner const struct bfd *bfd; const struct objfile *objfile; - const struct shobj *shobj; + const struct solib *solib; private: const void *m_v; @@ -79,7 +79,7 @@ struct target_section It is set by add_target_sections and used by remove_target_sections. For example, for executables it is a pointer to exec_bfd and - for shlibs it is the shobj pointer. */ + for shlibs it is the solib pointer. */ target_section_owner owner; }; From patchwork Mon Feb 5 20:18:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 85320 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2CAC63857C48 for ; Mon, 5 Feb 2024 20:21:12 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 480533858C2F for ; Mon, 5 Feb 2024 20:19:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 480533858C2F Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 480533858C2F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707164404; cv=none; b=TaXOkalUIierMI/Zi5jyIDw9IvDMFHA0T5Y25k4Pb7WLiFRdH5fhf6zxD5WUGdkc37EjXC//G0b66QAfevR/XmhXbWnHts4ni/mbPMYGfyMcGOiPZieG/j+2iuw/EZmq+mV6ZuR8wB+HgMMhcJBesJbMbSfPzm6HQZAWHlWwlOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707164404; c=relaxed/simple; bh=Q9nuvCd8wzbA1CO1KrYnT/rGfG7UlwG/+h1Q5Mdnpzc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ry08GA5BF4w03euzKlQms8n0hnvq2oq6TTriP5aduzr+wIN3IAQszSHmo3+fJi4+FZPMwL6w0H7+CmHWqH4NH5DEEi6TFlCaMJxsnw6m5zIXyG4rwucxP+VIyCOWvoUTC/RstpypCP5EKTuCFgJ5pTZmNFIdpUTLsGfwy90t0F8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (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 9C0471E0C3; Mon, 5 Feb 2024 15:19:56 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/2] gdb: rename target_so_ops to solib_ops Date: Mon, 5 Feb 2024 15:18:34 -0500 Message-ID: <20240205201954.122492-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240205201954.122492-1-simon.marchi@efficios.com> References: <20240205201954.122492-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1173.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org I don't like the name `target_so_ops`, because: - The name `target` is so overloaded, and in this case it's not even related to target_ops or anything else called "target". - We do have an implementation that actually fetches solibs from the target (solib_target_so_op in solib-target.c), so it's confusing for the "base class" to be called target_something as well. Rename to solib_ops. Change-Id: I46a983d44e81400470e22deb09aaf26ad8a3587f --- gdb/frv-tdep.h | 4 +- gdb/gdbarch-gen.h | 4 +- gdb/gdbarch.c | 6 +- gdb/gdbarch.h | 1 + gdb/gdbarch_components.py | 2 +- gdb/i386-nto-tdep.c | 2 +- gdb/mips-linux-tdep.c | 2 +- gdb/ppc-linux-tdep.c | 2 +- gdb/solib-aix.c | 16 +- gdb/solib-aix.h | 4 +- gdb/solib-darwin.c | 2 +- gdb/solib-darwin.h | 4 +- gdb/solib-dsbt.c | 2 +- gdb/solib-dsbt.h | 4 +- gdb/solib-frv.c | 6 +- gdb/solib-rocm.c | 2 +- gdb/solib-svr4.c | 8 +- gdb/solib-svr4.h | 4 +- gdb/solib-target.c | 2 +- gdb/solib-target.h | 4 +- gdb/solib.c | 399 +++++++++++++++++++------------------- gdb/solib.h | 2 +- gdb/solist.h | 2 +- gdb/windows-tdep.c | 4 +- 24 files changed, 243 insertions(+), 245 deletions(-) diff --git a/gdb/frv-tdep.h b/gdb/frv-tdep.h index d6128dd62715..95347ed224ed 100644 --- a/gdb/frv-tdep.h +++ b/gdb/frv-tdep.h @@ -118,7 +118,7 @@ CORE_ADDR frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point); needed for TLS support. */ CORE_ADDR frv_fetch_objfile_link_map (struct objfile *objfile); -struct target_so_ops; -extern const struct target_so_ops frv_so_ops; +struct solib_ops; +extern const solib_ops frv_so_ops; #endif /* FRV_TDEP_H */ diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h index 383a53a62f47..7a57bdcebe23 100644 --- a/gdb/gdbarch-gen.h +++ b/gdb/gdbarch-gen.h @@ -785,8 +785,8 @@ extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_s /* Vtable of solib operations functions. */ -extern const struct target_so_ops * gdbarch_so_ops (struct gdbarch *gdbarch); -extern void set_gdbarch_so_ops (struct gdbarch *gdbarch, const struct target_so_ops * so_ops); +extern const solib_ops * gdbarch_so_ops (struct gdbarch *gdbarch); +extern void set_gdbarch_so_ops (struct gdbarch *gdbarch, const solib_ops * so_ops); /* If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER evaluates non-zero, this is the address where the debugger will place diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 153327124fda..b9be3948d1ee 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -154,7 +154,7 @@ struct gdbarch gdbarch_single_step_through_delay_ftype *single_step_through_delay = nullptr; gdbarch_print_insn_ftype *print_insn = default_print_insn; gdbarch_skip_trampoline_code_ftype *skip_trampoline_code = generic_skip_trampoline_code; - const struct target_so_ops * so_ops = &solib_target_so_ops; + const solib_ops * so_ops = &solib_target_so_ops; gdbarch_skip_solib_resolver_ftype *skip_solib_resolver = generic_skip_solib_resolver; gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline = generic_in_solib_return_trampoline; gdbarch_in_indirect_branch_thunk_ftype *in_indirect_branch_thunk = default_in_indirect_branch_thunk; @@ -3398,7 +3398,7 @@ set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch->skip_trampoline_code = skip_trampoline_code; } -const struct target_so_ops * +const solib_ops * gdbarch_so_ops (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); @@ -3410,7 +3410,7 @@ gdbarch_so_ops (struct gdbarch *gdbarch) void set_gdbarch_so_ops (struct gdbarch *gdbarch, - const struct target_so_ops * so_ops) + const solib_ops * so_ops) { gdbarch->so_ops = so_ops; } diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index cabafbaa0be7..77d3406779ff 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -58,6 +58,7 @@ struct thread_info; struct ui_out; struct inferior; struct x86_xsave_layout; +struct solib_ops; #include "regcache.h" diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py index 9791bc07581c..d76b820c1b55 100644 --- a/gdb/gdbarch_components.py +++ b/gdb/gdbarch_components.py @@ -1383,7 +1383,7 @@ Function( Value( comment="Vtable of solib operations functions.", - type="const struct target_so_ops *", + type="const solib_ops *", name="so_ops", predefault="&solib_target_so_ops", printer="host_address_to_string (gdbarch->so_ops)", diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c index 0d05d65bf3bd..5e959df4df36 100644 --- a/gdb/i386-nto-tdep.c +++ b/gdb/i386-nto-tdep.c @@ -316,7 +316,7 @@ static void i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { i386_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - static struct target_so_ops nto_svr4_so_ops; + static solib_ops nto_svr4_so_ops; /* Deal with our strange signals. */ nto_initialize_signals (); diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 74411cdf43f4..9ecf698113b1 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -46,7 +46,7 @@ #include "features/mips64-linux.c" #include "features/mips64-dsp-linux.c" -static struct target_so_ops mips_svr4_so_ops; +static solib_ops mips_svr4_so_ops; /* This enum represents the signals' numbers on the MIPS architecture. It just contains the signal definitions which are diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index aa1b3b908f7d..a7c1104b29f4 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -87,7 +87,7 @@ #include "dwarf2/frame.h" /* Shared library operations for PowerPC-Linux. */ -static struct target_so_ops powerpc_so_ops; +static solib_ops powerpc_so_ops; /* The syscall's XML filename for PPC and PPC64. */ #define XML_SYSCALL_FILENAME_PPC "syscalls/ppc-linux.xml" diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index 70bfe258e678..8c8f219bdc59 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -308,7 +308,7 @@ solib_aix_bss_data_overlap (bfd *abfd) return 0; } -/* Implement the "relocate_section_addresses" target_so_ops method. */ +/* Implement the "relocate_section_addresses" solib_ops method. */ static void solib_aix_relocate_section_addresses (solib &so, target_section *sec) @@ -412,7 +412,7 @@ solib_aix_get_section_offsets (struct objfile *objfile, return offsets; } -/* Implement the "solib_create_inferior_hook" target_so_ops method. */ +/* Implement the "solib_create_inferior_hook" solib_ops method. */ static void solib_aix_solib_create_inferior_hook (int from_tty) @@ -443,7 +443,7 @@ solib_aix_solib_create_inferior_hook (int from_tty) } } -/* Implement the "current_sos" target_so_ops method. */ +/* Implement the "current_sos" solib_ops method. */ static intrusive_list solib_aix_current_sos () @@ -493,7 +493,7 @@ solib_aix_current_sos () return sos; } -/* Implement the "open_symbol_file_object" target_so_ops method. */ +/* Implement the "open_symbol_file_object" solib_ops method. */ static int solib_aix_open_symbol_file_object (int from_tty) @@ -501,7 +501,7 @@ solib_aix_open_symbol_file_object (int from_tty) return 0; } -/* Implement the "in_dynsym_resolve_code" target_so_ops method. */ +/* Implement the "in_dynsym_resolve_code" solib_ops method. */ static int solib_aix_in_dynsym_resolve_code (CORE_ADDR pc) @@ -509,7 +509,7 @@ solib_aix_in_dynsym_resolve_code (CORE_ADDR pc) return 0; } -/* Implement the "bfd_open" target_so_ops method. */ +/* Implement the "bfd_open" solib_ops method. */ static gdb_bfd_ref_ptr solib_aix_bfd_open (const char *pathname) @@ -679,8 +679,8 @@ solib_aix_normal_stop_observer (struct bpstat *unused_1, int unused_2) data->library_list.reset (); } -/* The target_so_ops for AIX targets. */ -const struct target_so_ops solib_aix_so_ops = +/* The solib_ops for AIX targets. */ +const solib_ops solib_aix_so_ops = { solib_aix_relocate_section_addresses, nullptr, diff --git a/gdb/solib-aix.h b/gdb/solib-aix.h index d47afb30e24b..6487460b04c3 100644 --- a/gdb/solib-aix.h +++ b/gdb/solib-aix.h @@ -18,8 +18,8 @@ #ifndef SOLIB_AIX_H #define SOLIB_AIX_H -struct target_so_ops; -extern const struct target_so_ops solib_aix_so_ops; +struct solib_ops; +extern const solib_ops solib_aix_so_ops; extern CORE_ADDR solib_aix_get_toc_value (CORE_ADDR pc); diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 27d4546e5774..5ef0646d5385 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -655,7 +655,7 @@ darwin_bfd_open (const char *pathname) return res; } -const struct target_so_ops darwin_so_ops = +const solib_ops darwin_so_ops = { darwin_relocate_section_addresses, nullptr, diff --git a/gdb/solib-darwin.h b/gdb/solib-darwin.h index ceabb95a0bd3..d6be9eb5b426 100644 --- a/gdb/solib-darwin.h +++ b/gdb/solib-darwin.h @@ -20,8 +20,8 @@ #ifndef SOLIB_DARWIN_H #define SOLIB_DARWIN_H -struct target_so_ops; +struct solib_ops; -extern const struct target_so_ops darwin_so_ops; +extern const solib_ops darwin_so_ops; #endif /* solib-darwin.h */ diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index d90bb7510a30..1dc85450e5f4 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -902,7 +902,7 @@ show_dsbt_debug (struct ui_file *file, int from_tty, gdb_printf (file, _("solib-dsbt debugging is %s.\n"), value); } -const struct target_so_ops dsbt_so_ops = +const solib_ops dsbt_so_ops = { dsbt_relocate_section_addresses, nullptr, diff --git a/gdb/solib-dsbt.h b/gdb/solib-dsbt.h index ccfee0841da5..e1f7d1438482 100644 --- a/gdb/solib-dsbt.h +++ b/gdb/solib-dsbt.h @@ -20,8 +20,8 @@ #ifndef SOLIB_DSBT_H #define SOLIB_DSBT_H -struct target_so_ops; +struct solib_ops; -extern const struct target_so_ops dsbt_so_ops; +extern const solib_ops dsbt_so_ops; #endif /* solib-dsbt.h */ diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 9a098f7943f2..c425b3376de0 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -237,7 +237,7 @@ static void frv_relocate_main_executable (void); static CORE_ADDR main_got (void); static int enable_break2 (void); -/* Implement the "open_symbol_file_object" target_so_ops method. */ +/* Implement the "open_symbol_file_object" solib_ops method. */ static int open_symbol_file_object (int from_tty) @@ -304,7 +304,7 @@ lm_base (void) } -/* Implement the "current_sos" target_so_ops method. */ +/* Implement the "current_sos" solib_ops method. */ static intrusive_list frv_current_sos () @@ -1073,7 +1073,7 @@ frv_fetch_objfile_link_map (struct objfile *objfile) return 0; } -const struct target_so_ops frv_so_ops = +const solib_ops frv_so_ops = { frv_relocate_section_addresses, nullptr, diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c index f4538c1540bb..02ab36bb95e6 100644 --- a/gdb/solib-rocm.c +++ b/gdb/solib-rocm.c @@ -154,7 +154,7 @@ struct solib_info /* Per-inferior data key. */ static const registry::key rocm_solib_data; -static target_so_ops rocm_solib_ops; +static solib_ops rocm_solib_ops; /* Fetch the solib_info data for INF. */ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index eb726a203af6..2377ed3341dc 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -977,7 +977,7 @@ svr4_free_objfile_observer (struct objfile *objfile) probes_table_remove_objfile_probes (objfile); } -/* Implement target_so_ops.clear_so. */ +/* Implement solib_ops.clear_so. */ static void svr4_clear_so (const solib &so) @@ -1386,7 +1386,7 @@ svr4_collect_probes_sos (svr4_info *info) return res; } -/* Implement the main part of the "current_sos" target_so_ops +/* Implement the main part of the "current_sos" solib_ops method. */ static intrusive_list @@ -1414,7 +1414,7 @@ svr4_current_sos_1 (svr4_info *info) return sos; } -/* Implement the "current_sos" target_so_ops method. */ +/* Implement the "current_sos" solib_ops method. */ static intrusive_list svr4_current_sos () @@ -3353,7 +3353,7 @@ svr4_iterate_over_objfiles_in_search_order } } -const struct target_so_ops svr4_so_ops = +const struct solib_ops svr4_so_ops = { svr4_relocate_section_addresses, svr4_clear_so, diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h index fe09c294c769..579fe6d98439 100644 --- a/gdb/solib-svr4.h +++ b/gdb/solib-svr4.h @@ -23,9 +23,9 @@ #include "solist.h" struct objfile; -struct target_so_ops; +struct solib_ops; -extern const struct target_so_ops svr4_so_ops; +extern const solib_ops svr4_so_ops; /* Link map info to include in an allocated so_list entry. */ diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 5e46adcf224a..bb4c6a6c174f 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -403,7 +403,7 @@ solib_target_in_dynsym_resolve_code (CORE_ADDR pc) return in_plt_section (pc); } -const struct target_so_ops solib_target_so_ops = +const solib_ops solib_target_so_ops = { solib_target_relocate_section_addresses, nullptr, diff --git a/gdb/solib-target.h b/gdb/solib-target.h index 177a15edb2ac..70f53c545532 100644 --- a/gdb/solib-target.h +++ b/gdb/solib-target.h @@ -20,7 +20,7 @@ #ifndef SOLIB_TARGET_H #define SOLIB_TARGET_H -struct target_so_ops; -extern const struct target_so_ops solib_target_so_ops; +struct solib_ops; +extern const solib_ops solib_target_so_ops; #endif /* solib-target.h */ diff --git a/gdb/solib.c b/gdb/solib.c index be9ec3dde37f..0a888430cf9b 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -57,20 +57,22 @@ bool debug_solib; symbol files. This takes precedence over the environment variables PATH and LD_LIBRARY_PATH. */ static std::string solib_search_path; + static void show_solib_search_path (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - gdb_printf (file, _("The search path for loading non-absolute " - "shared library symbol files is %s.\n"), + gdb_printf (file, + _ ("The search path for loading non-absolute " + "shared library symbol files is %s.\n"), value); } /* Same as HAVE_DOS_BASED_FILE_SYSTEM, but useable as an rvalue. */ #if (HAVE_DOS_BASED_FILE_SYSTEM) -# define DOS_BASED_FILE_SYSTEM 1 +#define DOS_BASED_FILE_SYSTEM 1 #else -# define DOS_BASED_FILE_SYSTEM 0 +#define DOS_BASED_FILE_SYSTEM 0 #endif /* Return the full pathname of a binary file (the main executable or a @@ -111,7 +113,7 @@ show_solib_search_path (struct ui_file *file, int from_tty, static gdb::unique_xmalloc_ptr solib_find_1 (const char *in_pathname, int *fd, bool is_solib) { - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); int found_file = -1; gdb::unique_xmalloc_ptr temp_pathname; const char *fskind = effective_target_file_system_kind (); @@ -215,29 +217,27 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib) } /* Now see if we can open it. */ - found_file = gdb_open_cloexec (temp_pathname.get (), - O_RDONLY | O_BINARY, 0).release (); + found_file = gdb_open_cloexec (temp_pathname.get (), O_RDONLY | O_BINARY, 0) + .release (); /* If the search in gdb_sysroot failed, and the path name has a drive spec (e.g, c:/foo), try stripping ':' from the drive spec, and retrying in the sysroot: c:/foo/bar.dll ==> /sysroot/c/foo/bar.dll. */ - if (found_file < 0 - && sysroot != NULL + if (found_file < 0 && sysroot != NULL && HAS_TARGET_DRIVE_SPEC (fskind, in_pathname)) { bool need_dir_separator = !IS_DIR_SEPARATOR (in_pathname[2]); char drive[2] = { in_pathname[0], '\0' }; - temp_pathname.reset (concat (sysroot, - SLASH_STRING, - drive, + temp_pathname.reset (concat (sysroot, SLASH_STRING, drive, need_dir_separator ? SLASH_STRING : "", in_pathname + 2, (char *) NULL)); - found_file = gdb_open_cloexec (temp_pathname.get (), - O_RDONLY | O_BINARY, 0).release (); + found_file + = gdb_open_cloexec (temp_pathname.get (), O_RDONLY | O_BINARY, 0) + .release (); if (found_file < 0) { /* If the search in gdb_sysroot still failed, try fully @@ -250,8 +250,9 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib) need_dir_separator ? SLASH_STRING : "", in_pathname + 2, (char *) NULL)); - found_file = gdb_open_cloexec (temp_pathname.get (), - O_RDONLY | O_BINARY, 0).release (); + found_file + = gdb_open_cloexec (temp_pathname.get (), O_RDONLY | O_BINARY, 0) + .release (); } } @@ -282,8 +283,8 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib) solib_search_path (if any). */ if (is_solib && found_file < 0 && !solib_search_path.empty ()) found_file = openp (solib_search_path.c_str (), - OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, - in_pathname, O_RDONLY | O_BINARY, &temp_pathname); + OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname, + O_RDONLY | O_BINARY, &temp_pathname); /* If not found, and we're looking for a solib, next search the solib_search_path (if any) for the basename only (ignoring the @@ -310,10 +311,10 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib) /* If not found, and we're looking for a solib, next search the inferior's $LD_LIBRARY_PATH environment variable. */ if (is_solib && found_file < 0 && sysroot == NULL) - found_file = openp (current_inferior ()->environment.get - ("LD_LIBRARY_PATH"), - OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname, - O_RDONLY | O_BINARY, &temp_pathname); + found_file + = openp (current_inferior ()->environment.get ("LD_LIBRARY_PATH"), + OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname, + O_RDONLY | O_BINARY, &temp_pathname); if (fd == NULL) { @@ -427,8 +428,8 @@ solib_bfd_fopen (const char *pathname, int fd) if (abfd == NULL) { /* Arrange to free PATHNAME when the error is thrown. */ - error (_("Could not open `%s' as an executable file: %s"), - pathname, bfd_errmsg (bfd_get_error ())); + error (_ ("Could not open `%s' as an executable file: %s"), pathname, + bfd_errmsg (bfd_get_error ())); } return abfd; @@ -460,16 +461,16 @@ solib_bfd_open (const char *pathname) /* Check bfd format. */ if (!bfd_check_format (abfd.get (), bfd_object)) - error (_("`%s': not in executable format: %s"), + error (_ ("`%s': not in executable format: %s"), bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ())); /* Check bfd arch. */ b = gdbarch_bfd_arch_info (current_inferior ()->arch ()); if (!b->compatible (b, bfd_get_arch_info (abfd.get ()))) - error (_("`%s': Shared library architecture %s is not compatible " - "with target architecture %s."), bfd_get_filename (abfd.get ()), - bfd_get_arch_info (abfd.get ())->printable_name, - b->printable_name); + error (_ ("`%s': Shared library architecture %s is not compatible " + "with target architecture %s."), + bfd_get_filename (abfd.get ()), + bfd_get_arch_info (abfd.get ())->printable_name, b->printable_name); return abfd; } @@ -482,20 +483,20 @@ typedef std::unordered_map soname_build_id_map; /* Key used to associate a soname_build_id_map to a core file bfd. */ static const struct registry::key - cbfd_soname_build_id_data_key; + cbfd_soname_build_id_data_key; /* See solib.h. */ void -set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, - const char *soname, +set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname, const bfd_build_id *build_id) { gdb_assert (abfd.get () != nullptr); gdb_assert (soname != nullptr); gdb_assert (build_id != nullptr); - soname_build_id_map *mapptr = cbfd_soname_build_id_data_key.get (abfd.get ()); + soname_build_id_map *mapptr + = cbfd_soname_build_id_data_key.get (abfd.get ()); if (mapptr == nullptr) mapptr = cbfd_soname_build_id_data_key.emplace (abfd.get ()); @@ -541,7 +542,7 @@ get_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname) static int solib_map_sections (solib &so) { - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); gdb::unique_xmalloc_ptr filename (tilde_expand (so.so_name.c_str ())); gdb_bfd_ref_ptr abfd (ops->bfd_open (filename.get ())); @@ -565,16 +566,16 @@ solib_map_sections (solib &so) } if (abfd == nullptr || mismatch) { - scoped_fd fd = debuginfod_exec_query ((const unsigned char*) - build_id_hexstr.get (), - 0, so.so_name.c_str (), - &filename); + scoped_fd fd = debuginfod_exec_query ( + (const unsigned char *) build_id_hexstr.get (), 0, + so.so_name.c_str (), &filename); if (fd.get () >= 0) abfd = ops->bfd_open (filename.get ()); else if (mismatch) - warning (_("Build-id of %ps does not match core file."), - styled_string (file_name_style.style (), filename.get ())); + warning (_ ("Build-id of %ps does not match core file."), + styled_string (file_name_style.style (), + filename.get ())); } } @@ -591,7 +592,7 @@ solib_map_sections (solib &so) that objfile's path, and the target is different from the host, GDB/MI will not provide the correct host-side path. */ if (strlen (bfd_get_filename (so.abfd.get ())) >= SO_NAME_MAX_PATH_SIZE) - error (_("Shared library file name is too long.")); + error (_ ("Shared library file name is too long.")); so.so_name = bfd_get_filename (so.abfd.get ()); so.sections = build_section_table (so.abfd.get ()); @@ -628,7 +629,7 @@ solib_map_sections (solib &so) void solib::clear () { - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); this->sections.clear (); this->abfd = nullptr; @@ -667,7 +668,6 @@ solib_read_symbols (solib &so, symfile_add_flags flags) } else { - flags |= current_inferior ()->symfile_flags; try @@ -676,8 +676,8 @@ solib_read_symbols (solib &so, symfile_add_flags flags) so.objfile = nullptr; for (objfile *objfile : current_program_space->objfiles ()) { - if (filename_cmp (objfile_name (objfile), - so.so_name.c_str ()) == 0 + if (filename_cmp (objfile_name (objfile), so.so_name.c_str ()) + == 0 && objfile->addr_low == so.addr_low) { so.objfile = objfile; @@ -689,10 +689,9 @@ solib_read_symbols (solib &so, symfile_add_flags flags) section_addr_info sap = build_section_addr_info_from_section_table (so.sections); gdb_bfd_ref_ptr tmp_bfd = so.abfd; - so.objfile = symbol_file_add_from_bfd (tmp_bfd, - so.so_name.c_str (), - flags, &sap, - OBJF_SHARED, nullptr); + so.objfile + = symbol_file_add_from_bfd (tmp_bfd, so.so_name.c_str (), + flags, &sap, OBJF_SHARED, nullptr); so.objfile->addr_low = so.addr_low; } @@ -700,8 +699,9 @@ solib_read_symbols (solib &so, symfile_add_flags flags) } catch (const gdb_exception_error &e) { - exception_fprintf (gdb_stderr, e, _("Error while reading shared" - " library symbols for %s:\n"), + exception_fprintf (gdb_stderr, e, + _ ("Error while reading shared" + " library symbols for %s:\n"), so.so_name.c_str ()); } @@ -746,7 +746,7 @@ notify_solib_unloaded (program_space *pspace, const solib &so) void update_solib_list (int from_tty) { - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); /* We can reach here due to changing solib-search-path or the sysroot, before having any inferior. */ @@ -885,8 +885,8 @@ update_solib_list (int from_tty) catch (const gdb_exception_error &e) { exception_fprintf (gdb_stderr, e, - _("Error while mapping shared " - "library sections:\n")); + _ ("Error while mapping shared " + "library sections:\n")); } /* Notify any observer that the shared object has been @@ -905,12 +905,12 @@ update_solib_list (int from_tty) stand out well. */ if (not_found == 1) - warning (_("Could not load shared library symbols for %s.\n" - "Do you need \"set solib-search-path\" " - "or \"set sysroot\"?"), + warning (_ ("Could not load shared library symbols for %s.\n" + "Do you need \"set solib-search-path\" " + "or \"set sysroot\"?"), not_found_filename); else if (not_found > 1) - warning (_("\ + warning (_ ("\ Could not load shared library symbols for %d libraries, e.g. %s.\n\ Use the \"info sharedlibrary\" command to see the complete listing.\n\ Do you need \"set solib-search-path\" or \"set sysroot\"?"), @@ -918,7 +918,6 @@ Do you need \"set solib-search-path\" or \"set sysroot\"?"), } } - /* Return non-zero if NAME is the libpthread shared library. Uses a fairly simplistic heuristic approach where we check @@ -933,7 +932,7 @@ bool libpthread_name_p (const char *name) { return (strstr (name, "/libpthread") != NULL - || strstr (name, "/libc.") != NULL ); + || strstr (name, "/libc.") != NULL); } /* Return non-zero if SO is the libpthread shared library. */ @@ -960,11 +959,11 @@ solib_add (const char *pattern, int from_tty, int readsyms) { if (pattern != NULL) { - gdb_printf (_("Loading symbols for shared libraries: %s\n"), + gdb_printf (_ ("Loading symbols for shared libraries: %s\n"), pattern); } else - gdb_printf (_("Loading symbols for shared libraries.\n")); + gdb_printf (_ ("Loading symbols for shared libraries.\n")); } current_program_space->solib_add_generation++; @@ -974,7 +973,7 @@ solib_add (const char *pattern, int from_tty, int readsyms) char *re_err = re_comp (pattern); if (re_err) - error (_("Invalid regexp: %s"), re_err); + error (_ ("Invalid regexp: %s"), re_err); } update_solib_list (from_tty); @@ -988,18 +987,17 @@ solib_add (const char *pattern, int from_tty, int readsyms) symfile_add_flags add_flags = SYMFILE_DEFER_BP_RESET; if (from_tty) - add_flags |= SYMFILE_VERBOSE; + add_flags |= SYMFILE_VERBOSE; for (solib &gdb : current_program_space->solibs ()) - if (! pattern || re_exec (gdb.so_name.c_str ())) + if (!pattern || re_exec (gdb.so_name.c_str ())) { /* Normally, we would read the symbols from that library only if READSYMS is set. However, we're making a small exception for the pthread library, because we sometimes need the library symbols to be loaded in order to provide thread support (x86-linux for instance). */ - const int add_this_solib = - (readsyms || libpthread_solib_p (gdb)); + const int add_this_solib = (readsyms || libpthread_solib_p (gdb)); any_matches = true; if (add_this_solib) @@ -1009,7 +1007,7 @@ solib_add (const char *pattern, int from_tty, int readsyms) /* If no pattern was given, be quiet for shared libraries we have already loaded. */ if (pattern && (from_tty || info_verbose)) - gdb_printf (_("Symbols already loaded for %s\n"), + gdb_printf (_ ("Symbols already loaded for %s\n"), gdb.so_name.c_str ()); } else if (solib_read_symbols (gdb, add_flags)) @@ -1020,9 +1018,9 @@ solib_add (const char *pattern, int from_tty, int readsyms) if (loaded_any_symbols) breakpoint_re_set (); - if (from_tty && pattern && ! any_matches) - gdb_printf - ("No loaded shared libraries match the pattern `%s'.\n", pattern); + if (from_tty && pattern && !any_matches) + gdb_printf ("No loaded shared libraries match the pattern `%s'.\n", + pattern); if (loaded_any_symbols) { @@ -1052,7 +1050,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty) char *re_err = re_comp (pattern); if (re_err) - error (_("Invalid regexp: %s"), re_err); + error (_ ("Invalid regexp: %s"), re_err); } /* "0x", a little whitespace, and two hex digits per byte of pointers. */ @@ -1068,7 +1066,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty) { if (!so.so_name.empty ()) { - if (pattern && ! re_exec (so.so_name.c_str ())) + if (pattern && !re_exec (so.so_name.c_str ())) continue; ++nr_libs; } @@ -1090,7 +1088,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty) if (so.so_name.empty ()) continue; - if (pattern && ! re_exec (so.so_name.c_str ())) + if (pattern && !re_exec (so.so_name.c_str ())) continue; ui_out_emit_tuple tuple_emitter (uiout, "lib"); @@ -1106,9 +1104,8 @@ info_sharedlibrary_command (const char *pattern, int from_tty) uiout->field_skip ("to"); } - if (! top_level_interpreter ()->interp_ui_out ()->is_mi_like_p () - && so.symbols_loaded - && !objfile_has_symbols (so.objfile)) + if (!top_level_interpreter ()->interp_ui_out ()->is_mi_like_p () + && so.symbols_loaded && !objfile_has_symbols (so.objfile)) { so_missing_debug_info = true; uiout->field_string ("syms-read", "Yes (*)"); @@ -1125,15 +1122,15 @@ info_sharedlibrary_command (const char *pattern, int from_tty) if (nr_libs == 0) { if (pattern) - uiout->message (_("No shared libraries matched.\n")); + uiout->message (_ ("No shared libraries matched.\n")); else - uiout->message (_("No shared libraries loaded at this time.\n")); + uiout->message (_ ("No shared libraries loaded at this time.\n")); } else { if (so_missing_debug_info) - uiout->message (_("(*): Shared library is missing " - "debugging information.\n")); + uiout->message (_ ("(*): Shared library is missing " + "debugging information.\n")); } } @@ -1175,7 +1172,7 @@ solib_name_from_address (struct program_space *pspace, CORE_ADDR address) bool solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size) { - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); if (ops->keep_data_in_core) return ops->keep_data_in_core (vaddr, size) != 0; @@ -1188,17 +1185,15 @@ solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size) void clear_solib (void) { - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); disable_breakpoints_in_shlibs (); - current_program_space->so_list.clear_and_dispose ([] (solib *so) - { - notify_solib_unloaded (current_program_space, *so); - current_program_space->remove_target_sections (so); - delete so; - }); - + current_program_space->so_list.clear_and_dispose ([] (solib *so) { + notify_solib_unloaded (current_program_space, *so); + current_program_space->remove_target_sections (so); + delete so; + }); if (ops->clear_solib != nullptr) ops->clear_solib (current_program_space); @@ -1212,7 +1207,7 @@ clear_solib (void) void solib_create_inferior_hook (int from_tty) { - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); ops->solib_create_inferior_hook (from_tty); } @@ -1222,7 +1217,7 @@ solib_create_inferior_hook (int from_tty) bool in_solib_dynsym_resolve_code (CORE_ADDR pc) { - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); return ops->in_dynsym_resolve_code (pc) != 0; } @@ -1258,7 +1253,7 @@ no_shared_libraries (const char *ignored, int from_tty) void update_solib_breakpoints (void) { - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); if (ops->update_breakpoints != NULL) ops->update_breakpoints (); @@ -1269,7 +1264,7 @@ update_solib_breakpoints (void) void handle_solib_event (void) { - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); if (ops->handle_event != NULL) ops->handle_event (); @@ -1291,7 +1286,7 @@ static void reload_shared_libraries_1 (int from_tty) { if (print_symbol_loading_p (from_tty, 0, 0)) - gdb_printf (_("Loading symbols for shared libraries.\n")); + gdb_printf (_ ("Loading symbols for shared libraries.\n")); for (solib &so : current_program_space->solibs ()) { @@ -1302,8 +1297,8 @@ reload_shared_libraries_1 (int from_tty) if (from_tty) add_flags |= SYMFILE_VERBOSE; - gdb::unique_xmalloc_ptr filename - (tilde_expand (so.so_original_name.c_str ())); + gdb::unique_xmalloc_ptr filename ( + tilde_expand (so.so_original_name.c_str ())); gdb_bfd_ref_ptr abfd (solib_bfd_open (filename.get ())); if (abfd != NULL) found_pathname = bfd_get_filename (abfd.get ()); @@ -1314,7 +1309,7 @@ reload_shared_libraries_1 (int from_tty) || (found_pathname != NULL && filename_cmp (found_pathname, so.so_name.c_str ()) != 0)) { - if (so.objfile && ! (so.objfile->flags & OBJF_USERLOADED) + if (so.objfile && !(so.objfile->flags & OBJF_USERLOADED) && !solib_used (so)) so.objfile->unlink (); current_program_space->remove_target_sections (&so); @@ -1337,14 +1332,14 @@ reload_shared_libraries_1 (int from_tty) catch (const gdb_exception_error &e) { exception_fprintf (gdb_stderr, e, - _("Error while mapping " - "shared library sections:\n")); + _ ("Error while mapping " + "shared library sections:\n")); got_error = true; } - if (!got_error - && (auto_solib_add || was_loaded || libpthread_solib_p (so))) - solib_read_symbols (so, add_flags); + if (!got_error + && (auto_solib_add || was_loaded || libpthread_solib_p (so))) + solib_read_symbols (so, add_flags); } } } @@ -1355,7 +1350,7 @@ reload_shared_libraries (const char *ignored, int from_tty, { reload_shared_libraries_1 (from_tty); - const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); + const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); /* Creating inferior hooks here has two purposes. First, if we reload shared libraries then the address of solib breakpoint we've computed @@ -1419,9 +1414,9 @@ gdb_sysroot_changed (const char *ignored, int from_tty, if (!warning_issued) { - warning (_("\"%s\" is deprecated, use \"%s\" instead."), - old_prefix, new_prefix); - warning (_("sysroot set to \"%s\"."), gdb_sysroot.c_str ()); + warning (_ ("\"%s\" is deprecated, use \"%s\" instead."), old_prefix, + new_prefix); + warning (_ ("sysroot set to \"%s\"."), gdb_sysroot.c_str ()); warning_issued = true; } @@ -1434,19 +1429,18 @@ static void show_auto_solib_add (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - gdb_printf (file, _("Autoloading of shared library symbols is %s.\n"), + gdb_printf (file, _ ("Autoloading of shared library symbols is %s.\n"), value); } - /* Lookup the value for a specific symbol from dynamic symbol table. Look up symbol from ABFD. MATCH_SYM is a callback function to determine whether to pick up a symbol. DATA is the input of this callback function. Return 0 if symbol is not found. */ CORE_ADDR -gdb_bfd_lookup_symbol_from_symtab - (bfd *abfd, gdb::function_view match_sym) +gdb_bfd_lookup_symbol_from_symtab ( + bfd *abfd, gdb::function_view match_sym) { long storage_needed = bfd_get_symtab_upper_bound (abfd); CORE_ADDR symaddr = 0; @@ -1457,12 +1451,12 @@ gdb_bfd_lookup_symbol_from_symtab gdb::def_vector storage (storage_needed / sizeof (asymbol *)); asymbol **symbol_table = storage.data (); - unsigned int number_of_symbols = - bfd_canonicalize_symtab (abfd, symbol_table); + unsigned int number_of_symbols + = bfd_canonicalize_symtab (abfd, symbol_table); for (i = 0; i < number_of_symbols; i++) { - asymbol *sym = *symbol_table++; + asymbol *sym = *symbol_table++; if (match_sym (sym)) { @@ -1478,7 +1472,9 @@ gdb_bfd_lookup_symbol_from_symtab if (bfd_get_flavour (abfd) == bfd_target_elf_flavour && gdbarch_elf_make_msymbol_special_p (gdbarch)) { - struct minimal_symbol msym {}; + struct minimal_symbol msym + { + }; msym.set_value_address (symaddr); gdbarch_elf_make_msymbol_special (gdbarch, sym, &msym); @@ -1526,8 +1522,8 @@ gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr, return 0; bool found = false; - for (const target_section &target_section - : current_program_space->target_sections ()) + for (const target_section &target_section : + current_program_space->target_sections ()) if (sect == target_section.the_bfd_section) { dyn_addr = target_section.addr; @@ -1556,46 +1552,44 @@ gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr, /* Iterate over BUF and scan for DYNTAG. If found, set PTR and return. */ step = (arch_size == 32) ? sizeof (Elf32_External_Dyn) : sizeof (Elf64_External_Dyn); - for (bufend = buf + sect_size; - buf < bufend; - buf += step) - { - if (arch_size == 32) - { - x_dynp_32 = (Elf32_External_Dyn *) buf; - current_dyntag = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_tag); - dyn_ptr = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_un.d_ptr); - } - else - { - x_dynp_64 = (Elf64_External_Dyn *) buf; - current_dyntag = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_tag); - dyn_ptr = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_un.d_ptr); - } - if (current_dyntag == DT_NULL) - return 0; - if (current_dyntag == desired_dyntag) - { - /* If requested, try to read the runtime value of this .dynamic + for (bufend = buf + sect_size; buf < bufend; buf += step) + { + if (arch_size == 32) + { + x_dynp_32 = (Elf32_External_Dyn *) buf; + current_dyntag = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_tag); + dyn_ptr = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_un.d_ptr); + } + else + { + x_dynp_64 = (Elf64_External_Dyn *) buf; + current_dyntag = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_tag); + dyn_ptr = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_un.d_ptr); + } + if (current_dyntag == DT_NULL) + return 0; + if (current_dyntag == desired_dyntag) + { + /* If requested, try to read the runtime value of this .dynamic entry. */ - if (ptr) - { - struct type *ptr_type; - gdb_byte ptr_buf[8]; - CORE_ADDR ptr_addr_1; - - ptr_type - = builtin_type (current_inferior ()->arch ())->builtin_data_ptr; - ptr_addr_1 = dyn_addr + (buf - bufstart) + arch_size / 8; - if (target_read_memory (ptr_addr_1, ptr_buf, arch_size / 8) == 0) - dyn_ptr = extract_typed_address (ptr_buf, ptr_type); - *ptr = dyn_ptr; - if (ptr_addr) - *ptr_addr = dyn_addr + (buf - bufstart); - } - return 1; - } - } + if (ptr) + { + struct type *ptr_type; + gdb_byte ptr_buf[8]; + CORE_ADDR ptr_addr_1; + + ptr_type = builtin_type (current_inferior ()->arch ()) + ->builtin_data_ptr; + ptr_addr_1 = dyn_addr + (buf - bufstart) + arch_size / 8; + if (target_read_memory (ptr_addr_1, ptr_buf, arch_size / 8) == 0) + dyn_ptr = extract_typed_address (ptr_buf, ptr_type); + *ptr = dyn_ptr; + if (ptr_addr) + *ptr_addr = dyn_addr + (buf - bufstart); + } + return 1; + } + } return 0; } @@ -1619,7 +1613,8 @@ gdb_bfd_read_elf_soname (const char *filename) if (!gdb_bfd_scan_elf_dyntag (DT_SONAME, abfd.get (), &idx, nullptr)) return {}; - struct bfd_section *dynstr = bfd_get_section_by_name (abfd.get (), ".dynstr"); + struct bfd_section *dynstr + = bfd_get_section_by_name (abfd.get (), ".dynstr"); int sect_size = bfd_section_size (dynstr); if (dynstr == nullptr || sect_size <= idx) return {}; @@ -1643,8 +1638,8 @@ gdb_bfd_read_elf_soname (const char *filename) if symbol is not found. */ static CORE_ADDR -bfd_lookup_symbol_from_dyn_symtab - (bfd *abfd, gdb::function_view match_sym) +bfd_lookup_symbol_from_dyn_symtab ( + bfd *abfd, gdb::function_view match_sym) { long storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd); CORE_ADDR symaddr = 0; @@ -1654,8 +1649,8 @@ bfd_lookup_symbol_from_dyn_symtab unsigned int i; gdb::def_vector storage (storage_needed / sizeof (asymbol *)); asymbol **symbol_table = storage.data (); - unsigned int number_of_symbols = - bfd_canonicalize_dynamic_symtab (abfd, symbol_table); + unsigned int number_of_symbols + = bfd_canonicalize_dynamic_symtab (abfd, symbol_table); for (i = 0; i < number_of_symbols; i++) { @@ -1679,8 +1674,8 @@ bfd_lookup_symbol_from_dyn_symtab found. */ CORE_ADDR -gdb_bfd_lookup_symbol - (bfd *abfd, gdb::function_view match_sym) +gdb_bfd_lookup_symbol (bfd *abfd, + gdb::function_view match_sym) { CORE_ADDR symaddr = gdb_bfd_lookup_symbol_from_symtab (abfd, match_sym); @@ -1709,50 +1704,52 @@ remove_user_added_objfile (struct objfile *objfile) } void _initialize_solib (); + void _initialize_solib () { - gdb::observers::free_objfile.attach (remove_user_added_objfile, - "solib"); - gdb::observers::inferior_execd.attach ([] (inferior *exec_inf, - inferior *follow_inf) - { - solib_create_inferior_hook (0); - }, "solib"); - - add_com ("sharedlibrary", class_files, sharedlibrary_command, - _("Load shared object library symbols for files matching REGEXP.")); + gdb::observers::free_objfile.attach (remove_user_added_objfile, "solib"); + gdb::observers::inferior_execd.attach ( + [] (inferior *exec_inf, inferior *follow_inf) { + solib_create_inferior_hook (0); + }, + "solib"); + + add_com ( + "sharedlibrary", class_files, sharedlibrary_command, + _ ("Load shared object library symbols for files matching REGEXP.")); cmd_list_element *info_sharedlibrary_cmd = add_info ("sharedlibrary", info_sharedlibrary_command, - _("Status of loaded shared object libraries.")); + _ ("Status of loaded shared object libraries.")); add_info_alias ("dll", info_sharedlibrary_cmd, 1); add_com ("nosharedlibrary", class_files, no_shared_libraries, - _("Unload all shared object library symbols.")); - - add_setshow_boolean_cmd ("auto-solib-add", class_support, - &auto_solib_add, _("\ -Set autoloading of shared library symbols."), _("\ -Show autoloading of shared library symbols."), _("\ + _ ("Unload all shared object library symbols.")); + + add_setshow_boolean_cmd ("auto-solib-add", class_support, &auto_solib_add, + _ ("\ +Set autoloading of shared library symbols."), + _ ("\ +Show autoloading of shared library symbols."), + _ ("\ If \"on\", symbols from all shared object libraries will be loaded\n\ automatically when the inferior begins execution, when the dynamic linker\n\ informs gdb that a new library has been loaded, or when attaching to the\n\ inferior. Otherwise, symbols must be loaded manually, using \ `sharedlibrary'."), - NULL, - show_auto_solib_add, - &setlist, &showlist); + NULL, show_auto_solib_add, &setlist, &showlist); set_show_commands sysroot_cmds = add_setshow_optional_filename_cmd ("sysroot", class_support, - &gdb_sysroot, _("\ -Set an alternate system root."), _("\ -Show the current system root."), _("\ + &gdb_sysroot, _ ("\ +Set an alternate system root."), + _ ("\ +Show the current system root."), + _ ("\ The system root is used to load absolute shared library symbol files.\n\ For other (relative) files, you can add directories using\n\ `set solib-search-path'."), - gdb_sysroot_changed, - NULL, - &setlist, &showlist); + gdb_sysroot_changed, NULL, &setlist, + &showlist); add_alias_cmd ("solib-absolute-prefix", sysroot_cmds.set, class_support, 0, &setlist); @@ -1760,22 +1757,22 @@ For other (relative) files, you can add directories using\n\ &showlist); add_setshow_optional_filename_cmd ("solib-search-path", class_support, - &solib_search_path, _("\ + &solib_search_path, _ ("\ Set the search path for loading non-absolute shared library symbol files."), - _("\ + _ ("\ Show the search path for loading non-absolute shared library symbol files."), - _("\ + _ ("\ This takes precedence over the environment variables \ PATH and LD_LIBRARY_PATH."), reload_shared_libraries, - show_solib_search_path, - &setlist, &showlist); - - add_setshow_boolean_cmd ("solib", class_maintenance, - &debug_solib, _("\ -Set solib debugging."), _("\ -Show solib debugging."), _("\ + show_solib_search_path, &setlist, + &showlist); + + add_setshow_boolean_cmd ("solib", class_maintenance, &debug_solib, _ ("\ +Set solib debugging."), + _ ("\ +Show solib debugging."), + _ ("\ When true, solib-related debugging output is enabled."), - nullptr, nullptr, - &setdebuglist, &showdebuglist); + nullptr, nullptr, &setdebuglist, &showdebuglist); } diff --git a/gdb/solib.h b/gdb/solib.h index d267e3fefa47..69183278318b 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -23,7 +23,7 @@ /* Forward decl's for prototypes */ struct solib; struct target_ops; -struct target_so_ops; +struct solib_ops; struct program_space; #include "gdb_bfd.h" diff --git a/gdb/solist.h b/gdb/solist.h index b485d3748800..f0d22080de17 100644 --- a/gdb/solist.h +++ b/gdb/solist.h @@ -93,7 +93,7 @@ struct solib : intrusive_list_node CORE_ADDR addr_low = 0, addr_high = 0; }; -struct target_so_ops +struct solib_ops { /* Adjust the section binding addresses by the base address at which the object was actually mapped. */ diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index f30c449e8bef..2750e663b7f1 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -862,7 +862,7 @@ windows_get_siginfo_type (struct gdbarch *gdbarch) return siginfo_type; } -/* Implement the "solib_create_inferior_hook" target_so_ops method. */ +/* Implement the "solib_create_inferior_hook" solib_ops method. */ static void windows_solib_create_inferior_hook (int from_tty) @@ -910,7 +910,7 @@ windows_solib_create_inferior_hook (int from_tty) } } -static struct target_so_ops windows_so_ops; +static solib_ops windows_so_ops; /* Common parts for gdbarch initialization for the Windows and Cygwin OS ABIs. */