This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
PythonGDB access to the loaded ELF files
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb at sourceware dot org
- Date: Thu, 24 Sep 2015 19:16:27 +0200
- Subject: PythonGDB access to the loaded ELF files
- Authentication-results: sourceware.org; auth=none
Hi,
there is a need to access ELF files (from Python in GDB) of loaded inferior
shared libraries, for example to read custom PT_NOTEs there. Has anyone
experience with it?
I guess one can use existing Objfile.filename (*) and open it with one of
several available Python ELF libraries.
One can map PC (from a frame) to Objfile various ways in GDB Python API.
Just I do not see how to relocate the ELF file to read, I do not see how to
access Objfile's any loaded address. (One could only run "info sharedlibrary"
or "info files" and parse its text output but that is sure not acceptable.)
Thanks,
Jan
(*)
Using fd would not be great as BFD closes/reopens it very often, there is
a pending fix for that:
https://sourceware.org/ml/gdb-patches/2015-02/msg00457.html