libdl: How to debug dl object with GDB
Hesham Almatary
heshamelmatary at gmail.com
Thu Nov 19 06:33:34 UTC 2020
Thanks for the info, Chris.
On Wed, 18 Nov 2020 at 02:43, Chris Johns <chrisj at rtems.org> wrote:
>
>
>
> On 17/11/20 10:43 pm, Hesham Almatary wrote:
> > Hello,
> >
> > I am trying to debug a dynamically loaded ELF object with GDB: My setup is:
> > rtems-riscv64:
> > GDB: GNU gdb (GDB) 10.0.50.20200904-git (build with RSB/rtems6)
> > Host: Ubuntu 20.04.1 LTS
> >
> > GDB doesn't seem to notice when I dlopen an object (which gets loaded,
> > linked and run fine).
>
> libdl has the NetBSD type support built in for debugging. A function is called
> when a module is loaded and there is a table of modules GDB reads and then loads
> the object file.
>
Is that expected to work on Linux with recent GDB versions? GDB
doesn't seem to detect when "_rtld_debug_state" is called from dlopen,
and consequently isn't aware of the list of objects. Does that need
GDB to be modified with solib-rtems* or something?
> > Any instructions or idea how to troubleshoot that further?
>
> At this point the simplest path is to get the load address(es) and load the
> symbols with the VMA.
>
I can use "add-symbol-file" filename for each object and give it the
text_base address. This only allows me to break on functions within
loaded objects. If that's not what you mean, how can I load the
symbols with the VMA?
> Anything else would require adding support to GDB or maybe a python module would
> work. I am not sure if the python approach is possible.
>
> Chris
--
Hesham
More information about the devel
mailing list