libdl: How to debug dl object with GDB

Chris Johns chrisj at rtems.org
Wed Nov 18 00:43:36 UTC 2020



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.

> 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.

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


More information about the devel mailing list