3

我正在尝试调试一些应用程序,并且我想使用以下命令传递一些数据,但出现错误。

    ....
    ....
    (gdb) x/20x $esp
    Value can't be converted to integer.
    (gdb)

我的 GDB 版本如下:

#gdb -v
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
4

2 回答 2

6

您从 64 位系统运行它,因此您应该使用寄存器名称作为 rip 而不是 eip 等所有寄存器。

例如:

(gdb) x/x $rip
0x4004c8 : 0x4005d8b8

获取信息寄存器以查看所有(gdb)信息寄存器

rax 0x7ffff7dd9f60 140737351884640

RBX 0x0 0

回复 0x0 0

rdx 0x7ffffffffe188 140737488347528

rsi 0x7ffffffffe178 140737488347512

rdi 0x1 1

rbp 0x7ffffffffe090 0x7ffffffffe090

回复 0x7ffffffffe090 0x7ffffffffe090

r8 0x7ffff7dd8300 140737351877376

r9 0x7ffff7deb9e0 140737351956960

r10 0x7fffffffdee0 140737488346848

r11 0x7ffff7a68be0 140737348275168

r12 0x4003e0 4195296

r13 0x7ffffffffe170 140737488347504

r14 0x0 0

r15 0x0 0

撕裂 0x4004c8 0x4004c8

eflags 0x246 [PF ZF IF]

CS 0x33 51

ss 0x2b 43

ds 0x0 0

es 0x0 0

fs 0x0 0

于 2014-01-29T14:19:01.410 回答
4

(gdb) x/20x $esp
Value can't be converted to integer.

尝试x/20x $rspx/20x $sp

于 2012-07-26T02:05:21.520 回答