From: Simon Marchi Date: Mon, 26 May 2025 20:26:11 +0000 (-0400) Subject: gdb: fix stale references to so_list X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cba1c145af1db70e42e9a5b51919e5555a336d8d;p=thirdparty%2Fbinutils-gdb.git gdb: fix stale references to so_list Adjust some comments and function names that refer to the ancient so_list type. Update some other stale comments in solib-svr4.c at the same time. Change-Id: Ia42efa6554d0cc6abb4183b6bffc96c6358c5735 Reviewed-By: Guinevere Larsen --- diff --git a/gdb/progspace.h b/gdb/progspace.h index 1ae826d6549..74c1c275b0e 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -231,7 +231,7 @@ struct program_space is outside all objfiles in this progspace. */ struct objfile *objfile_for_address (CORE_ADDR address); - /* Return the list of all the solibs in this program space. */ + /* Return the list of all the solibs in this program space. */ owning_intrusive_list &solibs () { return so_list; } diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index ef033d0cda3..a2c30fa19db 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -133,7 +133,7 @@ darwin_load_image_infos (struct darwin_info *info) (buf + 8 + ptr_type->length (), ptr_type); } -/* Link map info to include in an allocated so_list entry. */ +/* Link map info to include in an allocated solib entry. */ struct lm_info_darwin final : public lm_info { diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index d1735f268fc..05c5616cfb1 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -121,7 +121,7 @@ struct dbst_ext_link_map ext_ptr l_next, l_prev; /* struct link_map *l_next, *l_prev; */ }; -/* Link map info to include in an allocated so_list entry */ +/* Link map info to include in an allocated solib entry */ struct lm_info_dsbt final : public lm_info { diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 2b39d152141..4f52614ba90 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -194,7 +194,7 @@ struct ext_link_map ext_ptr l_next, l_prev; /* struct link_map *l_next, *l_prev; */ }; -/* Link map info to include in an allocated so_list entry. */ +/* Link map info to include in an allocated solib entry. */ struct lm_info_frv final : public lm_info { diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c index 94aa68b8667..a5eaee73f2e 100644 --- a/gdb/solib-rocm.c +++ b/gdb/solib-rocm.c @@ -202,10 +202,10 @@ rocm_solib_handle_event () rocm_update_solib_list (); } -/* Create so_list objects from rocm_so objects in SOS. */ +/* Create solib objects from rocm_so objects in SOS. */ static owning_intrusive_list -so_list_from_rocm_sos (const std::vector &sos) +solibs_from_rocm_sos (const std::vector &sos) { owning_intrusive_list dst; @@ -236,13 +236,13 @@ rocm_solib_current_sos () if (dev_sos.empty ()) return sos; - owning_intrusive_list dev_so_list = so_list_from_rocm_sos (dev_sos); + owning_intrusive_list dev_solibs = solibs_from_rocm_sos (dev_sos); if (sos.empty ()) - return dev_so_list; + return dev_solibs; /* Append our libraries to the end of the list. */ - sos.splice (std::move (dev_so_list)); + sos.splice (std::move (dev_solibs)); return sos; } diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 6a1cc10f0f6..4c0a8a1246e 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1046,10 +1046,10 @@ svr4_clear_so (const solib &so) li->l_addr_p = 0; } -/* Create the so_list objects equivalent to the svr4_sos in SOS. */ +/* Create the solib objects equivalent to the svr4_sos in SOS. */ static owning_intrusive_list -so_list_from_svr4_sos (const std::vector &sos) +solib_from_svr4_sos (const std::vector &sos) { owning_intrusive_list dst; @@ -1176,11 +1176,10 @@ static const struct gdb_xml_element svr4_library_list_elements[] = { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } }; -/* Parse qXfer:libraries:read packet into *SO_LIST_RETURN. Return 1 if +/* Parse qXfer:libraries:read packet into *LIST. - Return 0 if packet not supported, *SO_LIST_RETURN is not modified in such - case. Return 1 if *SO_LIST_RETURN contains the library list, it may be - empty, caller is responsible for freeing all its entries. */ + Return 0 if packet not supported, *LIST is not modified in such case. + Return 1 if *LIST contains the library list. */ static int svr4_parse_libraries (const char *document, struct svr4_library_list *list) @@ -1202,11 +1201,11 @@ svr4_parse_libraries (const char *document, struct svr4_library_list *list) return 0; } -/* Attempt to get so_list from target via qXfer:libraries-svr4:read packet. +/* Attempt to get the shared object list from target via + qXfer:libraries-svr4:read packet. - Return 0 if packet not supported, *SO_LIST_RETURN is not modified in such - case. Return 1 if *SO_LIST_RETURN contains the library list, it may be - empty, caller is responsible for freeing all its entries. + Return 0 if packet not supported, *LIST is not modified in such case. + Return 1 if *LIST contains the library list. Note that ANNEX must be NULL if the remote does not explicitly allow qXfer:libraries-svr4:read packets with non-empty annexes. Support for @@ -1450,7 +1449,7 @@ svr4_collect_probes_sos (svr4_info *info) for (const auto &tuple : info->solib_lists) { const std::vector &sos = tuple.second; - res.splice (so_list_from_svr4_sos (sos)); + res.splice (solib_from_svr4_sos (sos)); } return res; diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h index e59c8e4a499..d75d731d0ae 100644 --- a/gdb/solib-svr4.h +++ b/gdb/solib-svr4.h @@ -27,7 +27,7 @@ struct solib_ops; extern const solib_ops svr4_so_ops; -/* Link map info to include in an allocated so_list entry. */ +/* Link map info to include in an allocated solib entry. */ struct lm_info_svr4 final : public lm_info { diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 42979323c83..384282441e4 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -30,7 +30,7 @@ struct lm_info_target final : public lm_info { /* The library's name. The name is normally kept in the struct - so_list; it is only here during XML parsing. */ + solib; it is only here during XML parsing. */ std::string name; /* The target can either specify segment bases or section bases, not diff --git a/gdb/solib.c b/gdb/solib.c index 1c267cf973f..269482d28de 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1480,7 +1480,7 @@ reload_shared_libraries (const char *ignored, int from_tty, if (target_has_execution ()) { /* Reset or free private data structures not associated with - so_list entries. */ + solib entries. */ if (ops->clear_solib != nullptr) ops->clear_solib (current_program_space); diff --git a/gdb/solib.h b/gdb/solib.h index 360b6ef72db..e10f7cf6c7a 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -89,7 +89,8 @@ extern void no_shared_libraries (program_space *pspace); Extract the list of currently loaded shared objects from the inferior, and compare it with the list of shared objects in the current program space's list of shared libraries. Edit - so_list_head to bring it in sync with the inferior's new list. + the current program space's solib list to bring it in sync with the + inferior's new list. If we notice that the inferior has unloaded some shared objects, free any symbolic info GDB had read about those shared objects. diff --git a/gdb/solist.h b/gdb/solist.h index 20ec5a380e5..fa5e4ffbd1b 100644 --- a/gdb/solist.h +++ b/gdb/solist.h @@ -109,7 +109,7 @@ struct solib_ops 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, + should not free resources associated to individual solib entries, those are cleared by the clear_so method. */ void (*clear_solib) (program_space *pspace); @@ -136,7 +136,7 @@ struct solib_ops /* Find and open shared library binary file. */ gdb_bfd_ref_ptr (*bfd_open) (const char *pathname); - /* Given two so_list objects, one from the GDB thread list + /* Given two solib objects, one from the GDB thread list and another from the list returned by current_sos, return 1 if they represent the same library. Falls back to using strcmp on ORIGINAL_NAME when set to nullptr. */ @@ -199,7 +199,7 @@ struct solib_ops std::vector (*get_solibs_in_ns) (int ns); }; -/* A unique pointer to a so_list. */ +/* A unique pointer to an solib. */ using solib_up = std::unique_ptr; /* Find main executable binary file. */