views:

326

answers:

3

How does objdump manage to display source code? Is there a reference to the source file in the binary? I tried running strings on the binary and couldn't find any reference to the source file listed...

Thanks.

+4  A: 

The following article may be helpful: Understanding ELF using readelf and objdump.

ChristopheD
nice read but it doesn't answer my question. thanks anyways
anon
+3  A: 

It does not display source code, it displays the disassembly of the binary. There is a 1-1 mapping between the binary and the assembly.

Bahbar
+5  A: 

objdump uses the DWARF debugging information compiled into the binary, which references the source file name. If the binary isn't compiled with debugging information, or objdump can't find the source file, then you don't get source code in your output - only assembly.

You don't see the source file name when you use strings on the binary, because DWARF uses compression.

caf