working with debug symbols

Nikos Karampatziakis
Wed May 19 05:48:00 GMT 2010

Hi everyone,

I am working on a project where, ideally, we would like to be able to
say for every byte in the .text section of an (ELF or PE) executable,
whether or not it is part of an instruction or not (i.e. whether it's
code or data). The executables will be compiled with gcc and debugging
information. At which granularity can we extract this information from
the debug symbols? I know it's possible to get back the addresses of
the function entry points. I assume we can also get the address of the
first instruction of most lines in a source file. I would appreciate
some pointers on how to do that. However, a way to tag each address as
code or data would be even better. Finally, will any of these break if
the debug symbols are stored outside the executable?

Thank you,

More information about the Binutils mailing list