Extend struct r_debug for libraries loaded with dlmopen
From
https://sourceware.org/bugzilla/show_bug.cgi?id=11839
If you have a program that calls dlmopen (LM_ID_NEWLM), gdb will never see the binary in its link map. This is not very surprising because the link map of the inferior as reported by the libc does not contain the newly-loaded binary. Instead, it is stored in a separate linkmap for the new namespace which gdb never goes to look in.
The proper way to deal with this would be probably to try to support the solaris librtld_db.so interface in the libc and then make gdb use it to read the inferior's link map.
Here is a proposal to address this issue:
- Bump
r_version
to 2. - Extend
struct r_debug
with a new field:
struct r_debug
{
...
/* Link to next r_debug struct. Each r_debug struct represents
a different namespace. The first r_debug struct is for the
default namespace. */
struct r_debug *r_next;
};
-
Provide a compatibility symbol,
_r_debug
for the default namespace. -
struct r_debug
may be extended in the future. All extensions will be backward compatible. Debuggers should check ther_version
field before accessing the new fields.