dwfl_attach_state alternative taking Ebl?
Thu Mar 30 10:57:00 GMT 2017
On Wed, 2017-03-29 at 23:57 +0200, Milian Wolff wrote:
> On Mittwoch, 29. März 2017 21:48:08 CEST Mark Wielaard wrote:
> > Would it help your use case if there was a dwfl_init_state (Dwfl *dwfl,
> > int e_machine, unsigned char ei_class, unsigned char ei_data, ...)?
> What magic values do I pass to e_machine, ei_class, ei_data?
That would be one of the EM e_machine architecture constants, ELFCLASS32
or ELFCLASS64 for ei_class and ELFDATA2LSB or ELFDATA2MSB for ei_data.
(e_machine could arguably be a GElf_Half).
> I guess the ebl API that takes the Elf architecture or archicture
> name would be better.
I think we should extend the ebl_openbackend calls with a variant that
takes all three machine/class/data constants. If you look at the
machines table in libebl/eblopenbackend.c you see that given just the EM
architecture constant or (emulation) name without an Elf handle given we
cannot distinguish between e.g. ppc64 (EM_PPC64/ELFCLASS64/ELFDATA2MSB)
and ppc64le (EM_PPC64/ELFCLASS64/ELFDATA2LSB). You may obviously counter
that just means that table isn't complete. But then we have to document
(and maybe export?) the emulation names that people can rely on. Which
is why I was suggesting we rely on the machine/class/data triple to
uniquely identify the architecture. Maybe that is inconvenient though?
> > And what exactly is your use case? Maybe we can come up with a better
> > interface.
> The use-case is parsing profiler data, e.g. in perfparser by Ulf / TQC. We
> don't mess with Elf* anywhere, but need it to let dwfl_attach_state figure out
> the target architecture. We do know the architecture already so this is a lot
> of jumping through hoops, to find a fitting Elf* that can be used for dwfl
OK. How do you know the Elf architecture in that case? How and by what
is it given? Is that an EM constant or some architecture string?
More information about the Elfutils-devel