How does objdump manage to display source code with the -S option?

objdump uses the DWARF debugging information compiled into the binary, which references the source file name. objdump tries to open the named source file to load the source and display it in the output. 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.

Leave a Comment

tech