Info about struct members in ELF?

Nick Clifton nickc@redhat.com
Fri Nov 7 09:13:00 GMT 2003


Hi Torsten,

> from an ELF file i can get some info about a const struct,
> for example its address, its size and its content.
>
> Does ELF support me somehow in interpreting the content?

No - the ELF format does not contain this kind of information.

What you need is debugging information.  The two most common kinds of
debug format are STABS and DWARF, both of which are supported by ELF
format files.

So you need to make sure that your binaries have been compiled with
debugging enabled (usually by adding the "-g" switch to the compiler's
command line) and then find out which kind of debug format is being
used and how to decode it.  You may find the code in the
binutils/readelf.c file helpful for seeing how to examine DWARF format
debug information and the code in binutils/debug.c useful for decoding
STABS information.

Cheers
        Nick



More information about the Binutils mailing list