This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [patch 1/3] Extend __libdw_open_file and elf_begin as *_at_offset
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Mon, 03 Mar 2014 17:02:59 +0100
- Subject: Re: [patch 1/3] Extend __libdw_open_file and elf_begin as *_at_offset
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