问题描述
当涉及到ELF时,两种随附的调试格式在其他格式中极为流行,即 STAB和DWARF .我想要一种简单的方法来确定给定的二进制文件是否包含一种形式或另一种形式的调试信息,最好不必检查节名称(.stab等).
When it comes to ELF, two accompanying debugging formats are overwhelmingly popular to others, namely STAB and DWARF. I'd like an easy way to ascertain whether a given binary contains debug information of one form or the other, preferably without having to inspect section names (.stab, etc.).
有什么好的方法可以做到这一点?
What are good ways of accomplishing this?
推荐答案
在过去10年中,ELF
平台上的任何当前编译器均未默认使用STABS
格式.绝对不是压倒性的流行".
The STABS
format has not been used by default by any current compilers on ELF
platforms for the last 10 years. It's definitely not "overwhelmingly popular".
告诉方式:
readelf -WS ./a.out | egrep '\.(stab |debug)'
如果二进制文件具有STABS
,您将看到.stab
部分.如果您具有DWARF
,则将看到.debug_info
,.debug_line
等.如果根本没有调试信息,您将什么也看不到.
You will see .stab
section if the binary has STABS
. You will see .debug_info
, .debug_line
, etc. if you have DWARF
. You'll see nothing if you don't have debug info at all.
如果不查看部分内容就无法完成:正是这些部分的存在或不存在使二进制文件包含或不包含调试信息.
Can't be done without looking at sections: it's the presence or absence of these sections that makes the binary contain or not contain debug info.
这篇关于如何最好地确定二进制文件是否包含STAB或DWARF调试信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!