如何知道ELF目标文件中的调试信息类型? [英] How can I know what type of debug info is in an ELF object file?

查看:540
本文介绍了如何知道ELF目标文件中的调试信息类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ELF对象文件。我想知道它包含哪种类型的调试信息。
它是使用Diab编译器(C源代码)针对PPC体系结构进行编译的。我很确定它是用调试符号构建的。

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.

我尝试使用 dwarfdump 提取调试信息,但是我没有用,所以我想调试信息是

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

使用objdump显示调试信息为空。

Using objdump to show debugging information comes up empty.

$ objdump -g file.elf 
file.elf:     file format elf32-powerpc

即使ELF文件包含名为的部分,该ELF文件是否也不包含调试信息。 debug_sfnames .debug_srcinfo .debug.srcinfo ?还是以 objdump 无法处理的格式存储调试信息?

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?

推荐答案

似乎没有人回答您的实际问题,即:如何以编程方式确定给定ELF二进制文件中存在的调试符号的形式。据我所知,这在ELF中没有明确给出;但是,可以通过ELF文件中特定节名称的存在来推断。例如:名为 .debug_info的部分表示DWARF2或更高版本,而 .stab的部分表示stab。
快速搜索 .debug_sfnames会提示DWARF1。 (我不知道为什么您的 dumpfdump没有识别出……也许您的 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?)

这篇关于如何知道ELF目标文件中的调试信息类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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