aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-tdep.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2021-10-04 10:24:35 +0200
committerMarkus Metzger <markus.t.metzger@intel.com>2022-10-18 14:16:08 +0200
commit8d56636a0ecbe6c38bf52b0683326ee21693c548 (patch)
treed31ea425eab963a5849039435427ea2880dba1c2 /gdb/linux-tdep.c
parent60d09f0a0d8000359b8f1dd14b51e7f013ea9e5c (diff)
downloadfsf-binutils-gdb-8d56636a0ecbe6c38bf52b0683326ee21693c548.zip
fsf-binutils-gdb-8d56636a0ecbe6c38bf52b0683326ee21693c548.tar.gz
fsf-binutils-gdb-8d56636a0ecbe6c38bf52b0683326ee21693c548.tar.bz2
gdb, gdbserver: support dlmopen()
In glibc, the r_debug structure contains (amongst others) the following fields: int r_version: Version number for this protocol. It should be greater than 0. If r_version is 2, struct r_debug is extended to struct r_debug_extended with one additional field: struct r_debug_extended *r_next; Link to the next r_debug_extended structure. Each r_debug_extended structure represents a different namespace. The first r_debug_extended structure is for the default namespace. 1. Change solib_svr4_r_map argument to take the debug base. 2. Add solib_svr4_r_next to find the link map in the next namespace from the r_next field. 3. Update svr4_current_sos_direct to get the link map in the next namespace from the r_next field. 4. Don't check shared libraries in other namespaces when updating shared libraries in a new namespace. 5. Update svr4_same to check the load offset in addition to the name 6. Update svr4_default_sos to also set l_addr_inferior 7. Change the flat solib_list into a per-namespace list using the namespace's r_debug address to identify the namespace. Add gdb.base/dlmopen.exp to test this. To remain backwards compatible with older gdbserver, we reserve the namespace zero for a flat list of solibs from all namespaces. Subsequent patches will extend RSP to allow listing libraries grouped by namespace. This fixes PR 11839. Co-authored-by: Lu, Hongjiu <hongjiu.lu@intel.com>
Diffstat (limited to 'gdb/linux-tdep.c')
-rw-r--r--gdb/linux-tdep.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index dccb45d..0a2fced 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -2826,6 +2826,7 @@ linux_ilp32_fetch_link_map_offsets ()
lmo.r_map_offset = 4;
lmo.r_brk_offset = 8;
lmo.r_ldsomap_offset = -1;
+ lmo.r_next_offset = 20;
/* Everything we need is in the first 20 bytes. */
lmo.link_map_size = 20;
@@ -2854,6 +2855,7 @@ linux_lp64_fetch_link_map_offsets ()
lmo.r_map_offset = 8;
lmo.r_brk_offset = 16;
lmo.r_ldsomap_offset = -1;
+ lmo.r_next_offset = 40;
/* Everything we need is in the first 40 bytes. */
lmo.link_map_size = 40;