gdb vs. objdump arm 反汇编函数分支名称解析 [英] gdb vs. objdump arm disassembler function branch name resolving

查看:22
本文介绍了gdb vs. objdump arm 反汇编函数分支名称解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题.如果我使用 objdump -d 来反汇编 ARM 二进制文件,它可以解析分支指令的函数(系统库)名称,例如:

I have a bit of strange question. If I use objdump -d for disassembling an ARM binary it can resolve the function (system library) names of branch instructions e.g.:

8404:   e581e000    str lr, [r1]
8408:   e59f0028    ldr r0, [pc, #40]   ; 8438 <address_of_message1>
840c:   ebffffc1    bl  8318 <printf@plt>
8410:   e59f0028    ldr r0, [pc, #40]   ; 8440 <address_of_scan_pattern>
8414:   e59f1028    ldr r1, [pc, #40]   ; 8444 <address_of_read>
8418:   ebffffc4    bl  8330 <scanf@plt>
841c:   e59f0018    ldr r0, [pc, #24]   ; 843c <address_of_message2>

所以我看到 bl 8318 会调用 printf.当我使用 gdb 和 disas 命令时,我得到了没有函数名称的反汇编(相同的代码示例),请参阅:

So I see bl 8318 will call printf. When I use gdb and the disas command I get the disassembly without the function name (same code sample), see:

   0x00008408 <+8>:     ldr r0, [pc, #40]   ; 0x8438 <address_of_message1>
   0x0000840c <+12>:    bl  0x8318
   0x00008410 <+16>:    ldr r0, [pc, #40]   ; 0x8440 <address_of_scan_pattern>
   0x00008414 <+20>:    ldr r1, [pc, #40]   ; 0x8444 <address_of_read>
   0x00008418 <+24>:    bl  0x8330

在 gdb 中,我只看到了 0x8330 的分支.

In gdb I see only the branch to 0x8330.

是否也可以使用 gdb 解析函数名称?

Is it possible to resolve the function name also with gdb ?

谁能向我解释为什么 objdump 可以解析系统函数调用的名称而 gdb 不能?

Can anybody explain to me why objdump can resolve the name of system functin calls and gdb not ?

推荐答案

gdb 和 GNU objdump 使用相同的库 (bfd) 来读取和解释库,但它是静态编译的.这意味着,旧版本的 gdb 显示的内容可能少于新的 objdump.

gdb and GNU objdump use the same library (bfd) to read and interpret library, but it's statically compiled in. That means, that an old version of gdb could show less then a newer objdump.

我在 hello world 上的 i386 上测试了最近的 objdump 和最近的 gdb,两者都显示了相同的信息.

I've tested a recent objdump and a recent gdb on i386 on a hello world and both show the same information.

请检查您是否使用了最新的 gdb.

Please check that you're using a recent gdb.

注意:printf@plt 函数不是 printf 本身,而是一个指向动态加载器的函数,它会在发生跳转时从共享库中加载真正的 printf

Note: the function printf@plt is not the printf itself, but a function pointing to the dynamic loader, that will load the real printf from a shared library when jump occurs

这篇关于gdb vs. objdump arm 反汇编函数分支名称解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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