objdump如何使用-S选项显示源代码? [英] How does objdump manage to display source code with the -S option?
问题描述
二进制文件中是否有对源文件的引用?我尝试在二进制文件上运行字符串,但找不到对列出的源文件的任何引用...
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...
推荐答案
objdump
使用编译到二进制文件中的DWARF调试信息,该信息引用了源文件名.如果二进制文件未使用调试信息进行编译,或者objdump
找不到源文件,则您不会在输出中获得源代码-仅汇编.
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.
在二进制文件上使用strings
时,您看不到源文件名,因为DWARF使用压缩.
You don't see the source file name when you use strings
on the binary, because DWARF uses compression.
这篇关于objdump如何使用-S选项显示源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!