aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-svr4.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-10-10 14:45:05 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-10-19 10:57:51 -0400
commit96bb3873ec2231b6a2db219773257996f5c91b55 (patch)
treef4259225a3f785428a6021f45d2942abcbc4119c /gdb/solib-svr4.h
parent3fcbae9d9c7cdc4103c4f494f5d3c63b373617ee (diff)
downloadgdb-96bb3873ec2231b6a2db219773257996f5c91b55.zip
gdb-96bb3873ec2231b6a2db219773257996f5c91b55.tar.gz
gdb-96bb3873ec2231b6a2db219773257996f5c91b55.tar.bz2
gdb: make solib-svr4 not use so_list internally
A subsequent patch makes use of non-trivial types in struct so_list. This trips on the fact that svr4_copy_library_list uses memcpy to copy so_list objects: so_list *newobj = new so_list; memcpy (newobj, src, sizeof (struct so_list)); solib-svr4 maintains lists of so_list objects in its own internal data structures. When requested to return a list of so_list objects (through target_so_ops::current_sos), it duplicates the internal so_list lists, using memcpy. When changing so_list to make it non-trivial, we would need to replace this use of memcpy somehow. That would mean making so_list copyable, with all the complexity that entails, just to satisfy this internal usage of solib-svr4 (and solib-rocm, which does the same). Change solib-svr4 to use its own data type for its internal lists. The use of so_list is a bit overkill anyway, as most fields of so_list are irrelevant for this internal use. - Introduce svr4_so, which contains just an std::string for the name and a unique_ptr for the lm_info. - Change the internal so_list lists to be std::vector<svr4_so>. Vector seems like a good choice for this, we don't need to insert/remove elements in the middle of these internal lists. - Remove svr4_free_library_list, free_solib_lists and ~svr4_info, as everything is managed automatically now. - Replace svr4_copy_library_list (which duplicated internal lists in order to return them to the core) with so_list_from_svr4_sos, which creates an so_list list from a vector of svr4_so. - Generalize svr4_same a bit, because find_debug_base_for_solib now needs to compare an so_list and an svr4_so to see if they are the same. Change-Id: I6012e48e07aace2a8172b74b389f9547ce777877 Approved-By: Pedro Alves <pedro@palves.net> Reviewed-By: Reviewed-By: Lancelot Six <lancelot.six@amd.com>
Diffstat (limited to 'gdb/solib-svr4.h')
-rw-r--r--gdb/solib-svr4.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h
index 1aff3b5..7cb6cab 100644
--- a/gdb/solib-svr4.h
+++ b/gdb/solib-svr4.h
@@ -48,6 +48,8 @@ struct lm_info_svr4 final : public lm_info
CORE_ADDR l_ld = 0, l_next = 0, l_prev = 0, l_name = 0;
};
+using lm_info_svr4_up = std::unique_ptr<lm_info_svr4>;
+
/* Critical offsets and sizes which describe struct r_debug and
struct link_map on SVR4-like targets. All offsets and sizes are
in bytes unless otherwise specified. */