objdump如何使用-S选项显示源代码? [英] How does objdump manage to display source code with the -S option?

查看:1193
本文介绍了objdump如何使用-S选项显示源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

二进制文件中是否有对源文件的引用?我尝试在二进制文件上运行字符串,但找不到对列出的源文件的任何引用...

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆