我如何知道 ELF 目标文件中的调试信息是什么类型?
我有一个 ELF 目标文件。我想知道它包含哪种类型的调试信息。 它是用针对 PPC 架构的 Diab 编译器(C 源代码)编译的。我很确定它是用调试符号构建的。
我尝试使用 dwarfdump 提取调试信息,但没有成功,所以我猜调试信息不是 DWARF 类型。
$ dwarfdump file.elf
No DWARF information present in file.elf
使用 objdump 显示调试信息显示为空。
$ objdump -g file.elf
file.elf: file format elf32-powerpc
难道这个 ELF 文件不包含调试信息,即使 ELF 文件有名为 .debug_sfnames
、.debug_srcinfo
和 .debug.srcinfo
的部分>?或者调试信息是否以 objdump 无法处理的格式存储?
I have an ELF object file. I want to know which type of debugging info it contains.
It was compiled with the Diab compiler (C source) for the PPC architecture. I'm pretty sure it was built with debugging symbols.
I have tried extracting the debugging info with dwarfdump
but I doesn't work so I guess the debugging information is not of type DWARF.
$ dwarfdump file.elf
No DWARF information present in file.elf
Using objdump to show debugging information comes up empty.
$ objdump -g file.elf
file.elf: file format elf32-powerpc
Can it be that this ELF file does not contain debugging info even though the ELF file has sections called .debug_sfnames
, .debug_srcinfo
and .debug.srcinfo
? Or is the debugging info stored in a format that objdump
can't handle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能应该使用 nm
或者,您可以使用 ldd 等工具来查看二进制文件需要哪些库。
You should probably use the nm
Alternatively you can use tools like
ldd
to see what libraries are required by a binary.似乎没有人回答过您的实际问题,即:如何以编程方式确定给定 ELF 二进制文件中存在的调试符号的风格。据我所知,ELF 中并没有明确给出这一点;但是,可以通过 ELF 文件中特定节名称的存在来推断。例如:名为“.debug_info”的部分暗示 DWARF2 或更高版本,而“.stab”暗示刺。
快速谷歌搜索“.debug_sfnames”表明 DWARF1。 (我不知道为什么你的“dwarfdump”没有识别出......也许你的 dwarfdump 适用于较新的 DWARF,并转储了向后兼容性?)
It doesn't seem like anyone ever answered your actual question, which is: how to programmatically determine the flavor of debug symbols present in a given ELF binary. As best as I can tell, this isn't given explicitly within ELF; however, it can be inferred by the presence of specific section names within the ELF file. For example: a section named ".debug_info" implies DWARF2 or better, whereas ".stab" implies stabs.
A quick googling of your ".debug_sfnames" suggests DWARF1. (I don't know why your 'dwarfdump' didn't identify that... perhaps your dwarfdump is for newer DWARFs, and dumped backwards compatibility?)
在 GNU/Linux 中:
返回二进制文件中使用的 DWARF 符号版本。
In GNU/Linux:
Returns the DWARF symbols version used in the binary.