Python API equivalent of 'info sharedlibrary'

Dominik Czarnota dominik.b.czarnota@gmail.com
Sat Mar 4 17:30:59 GMT 2023


Hi,

Is there any Python API equivalent of getting information about shared
libraries through the `info sharedlibrary` command?

If not, is there any chance that this gets added?

I know there is `gdb.objfiles()` but it seems it goes over all object
files [0] and does not really provide as much information as the `info
sharedlibrary` command [1].

In our plugin we try to figure out the exact path of the glibc library
and we want to support all possible use cases (gdb, gdbserver,
LD_PRELOAD, gdbstub from QEMU-user etc.). Of course this will always
be a heuristic since we can never know if a libc.so is actually a libc
and so on. We are currently parsing the output of the `info
sharedlibrary` command but this gets more and more complicated which
is not great... [2].

[0] https://github.com/bminor/binutils-gdb/blob/d1702fea87aa62dff7de465464097dba63cc8c0f/gdb/python/py-progspace.c#L343-L369
[1] https://github.com/bminor/binutils-gdb/blob/d1702fea87aa62dff7de465464097dba63cc8c0f/gdb/solib.c#L1062-L1163
[2] https://github.com/pwndbg/pwndbg/pull/1602/files

Best regards
Dominik 'Disconnect3d' Czarnota


More information about the Gdb mailing list