objdump 和 ARM 与 Thumb
我正在尝试使用 gcc 反汇编为 ARM 构建的对象。不幸的是,objdump 试图猜测代码是否是 ARM 和 Thumb,但结果是错误的:它认为我的代码是 Thumb,而实际上它是 ARM。
我看到 objdump 有一个选项可以强制它将所有指令解释为 Thumb (-Mforce-thumb
),但它没有一个选项可以强制 ARM 模式!
对我来说,这似乎是一个非常奇怪的遗漏,它严重妨碍了我完成工作的能力(我使用的是嵌入式设备,我唯一的调试方法就是查看反汇编)。我尝试了各种方法,包括尝试告诉 objdump 使用不支持 Thumb 的 ARM 架构,但似乎没有任何效果。有什么想法吗?
(是的,我知道这些指令确实 ARM...)
I'm trying to disassemble an object built for ARM with gcc. Unfortunately, objdump is trying to guess whether the code is ARM and Thumb, and is getting it wrong: it thinks my code is Thumb when it's actually ARM.
I see that objdump has an option to force it to interpret all instructions as Thumb (-Mforce-thumb
), but it doesn't have one to force ARM mode!
This seems like a really weird omission to me, and it's seriously hampering my ability to get work done (I'm on an embedded device and my only means of debugging is to look at the disassembly). I've tried various approaches, including trying to tell objdump to use an ARM architecture that doesn't support Thumb, but nothing seems to work. Any ideas?
(And yes, I know that the instructions really are ARM...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
arm-linux-gnueabi-objdump -marm -b binary -D
对我来说很有效。虽然它不保留符号信息,所以它不完全是您正在寻找的内容,但它为您提供了反汇编,这是一个开始。arm-linux-gnueabi-objdump -marm -b binary -D
does the trick for me. It doesn't preserve the symbol information though, so it's not quite what you are looking for, but it gives you the disassemble, which is a start.这听起来像是编译器/链接器或 objdump 中的错误。通常,如果符号是 Thumb 或 ARM,则应正确标记它们,并相应地反汇编。
也就是说,您可以尝试以下一些操作:
This sounds like a bug in either compiler/linker or objdump. Normally the symbols should be marked properly if they're Thumb or ARM and disassembled accordingly.
That said, there's a few things you can try: