Python API equivalent of 'info sharedlibrary'

Dominik Czarnota via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CABEVAa0Xt+tXv+C6-Gv9+jbvAN1-taUzRfMzRF4HPevre6886A@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.