0

Is there a way to extract the size and address of elements within a structure using an elf file? I am hoping there is a tool available that can do this and export it to a more readable format.

My end goal is to convert the ELF file to a ASAM A2L file. A open source/free tool that could do this would even be better but most companies that do this charge alot for their tools.

Steve S
  • 209
  • 4
  • 13

1 Answers1

1

I don't know offhand of anything pre-canned, but it isn't very hard to modify an existing tool to do it.

The "pahole" program from the "dwarves" project does something similar. It prints a structure definition in a certain way.

There's also a "pahole.py" script for gdb that does pretty much the same thing. This would be trivial to modify to print things however you like.

If you want to get a little deeper you could write it yourself using one of the existing DWARF libraries. I like the one in elfutils, but YMMV.

Tom Tromey
  • 21,507
  • 2
  • 45
  • 63