linux - 如何强制 gdb 将 plt 地址解析为反汇编输出中的名称?
问题描述
我得到了一个二进制文件。使用 gdb 加载并启动它后,我发现在disass
输出中call
指令总是显示 plt 地址而不是 plt 名称。在以下示例中,0x8048430
显示的是地址而不是函数名printf()
。
(gdb) disas chall
Dump of assembler code for function chall:
0x08048603 <+0>: push %ebp
0x08048604 <+1>: mov %esp,%ebp
0x08048606 <+3>: sub $0x418,%esp
0x0804860c <+9>: sub $0x8,%esp
0x0804860f <+12>: lea -0x40c(%ebp),%eax
0x08048615 <+18>: push %eax
0x08048616 <+19>: push $0x8048818
0x0804861b <+24>: call 0x8048430
0x08048620 <+29>: add $0x10,%esp
0x08048623 <+32>: sub $0xc,%esp
0x08048626 <+35>: push $0x8048830
0x0804862b <+40>: call 0x8048430 <========= PLT address
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) x/i 0x8048430
0x8048430: jmp *0x8049fe4 <================ GOT address
(gdb)
使用 pwntools 的 python 代码揭示了为什么0x8048430
和0x8049fe4
声称是的原因printf()
#!/usr/bin/python3.6
from pwn import *
filename = './ez_pz_hackover_2016'
e = ELF(filename)
log.level = 'DEBUG'
for k, v in e.got.items():
log.debug(f'got:{k}={hex(v)}')
具有以下输出:
[DEBUG] got:setbuf=0x8049fdc
[DEBUG] got:strcmp=0x8049fe0
[DEBUG] got:printf=0x8049fe4 <=====================
在 gdb 中阅读这样的程序集不是很方便disass
。是否有任何方便的方法可以自动将 plt 地址转换为 gdb 程序集中的名称?
解决方案
推荐阅读
- machine-learning - 回归算法是否为您提供与预测值相关的概率?
- ubuntu - 指纹 uau 4500 与 ubuntu 18.04
- c# - 当我的角色在 NPC 的对撞机中并且按下按钮时尝试切换相机
- c - 用于结构的 Malloc - C
- java - 使用 .properties 文件中的值设置此类的成员变量的最佳方法是什么?
- css - 正确定位绝对定位元素的工具提示
- python - 使用 numpy/pandas 查找到参考项目的距离
- excel - 在 Python Pandas 中用 excel 编写大型数据集的输出
- scala - 在 intelliJ 源根与测试源根
- c++ - 建议在我的 RayTracer 上查找此渲染伪影的原因