This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Readelf vs objdump


Daniel Jacobowitz wrote:

On Tue, Nov 18, 2003 at 05:22:46PM -0800, Stan Shebs wrote:

So, fresh from the stunning success of Panther, and scanning the horizon for
new prey to consu^Wassim^Wadopt :-) , we've been looking a bit at the prospects
for moving from stabs to dwarf2 debugging. It's not too hard to tweak Darwin
GDB and GCC to get something minimal working using Mach-O object files, but in
order to scale up and improve performance, we could really use a dwarf dumper,
such as the one in readelf.


While it seems like an obvious thing to hack up the dwarf dumping code so
that it can be used in objdump for non-ELF, it makes me wonder why there is a
separate readelf program in the first place. Is this just historical, or is
there a fundamental reason why binutils has two file dumpers? (I understand
that the details of functionality are different, but that's not a fundamental
reason to have two.)



The difference in implementation is actually pretty fundamental. Objdump sees an ELF file through a BFD filter of the world; if bfd
has a bug where, say, it disagrees about a machine constant in e_flags,
then the odds are good that it will remain internally consistent. The
linker sees it the BFD way, objdump sees it the BFD way, gas sees it
the BFD way. There was need for a tool to go find out what the file
actually says.



Hmm, I was hoping there was a stronger rationale; readelf has different
functionality, so it's not like you can diff its output with objdump to
confirm correctness.

Stan



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]