On Sun, 2014-03-02 at 22:29 +0100, Jan Kratochvil wrote: > On Tue, 25 Feb 2014 23:12:04 +0100, Mark Wielaard wrote: > > I rather not extend the libelf interface if possible. The various libelf > > implementations are already a little diverged. Lets not unnecessarily > > make the divergence even bigger. > > I was aware of this issue but I had no other idea.
I had hoped mmapping things and using using elf_memory () would just work. But it isn't too surprising that /proc/PID/mem cannot be mmapped. So then you are left with how elf_from_remote_memory does it by mallocing the ELF image space and reading it in itself and then using elf_memory (). Another way is what libdwfl/open.c does in __libdw_open_file () by pretending to have an ar archive member which starts at a given offset. Which I admit is like the comment says "pure evil". Cheers, Mark
