GDB错误值无法转换为整数

时间:2012-07-25 19:57:59

标签: linux debugging gdb

我正在尝试调试某些应用程序,我想使用以下命令传递一些数据,但我收到错误。

    ....
    ....
    (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/>.

2 个答案:

答案 0 :(得分:2)

  

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

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

答案 1 :(得分:1)

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

例如:

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

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

rax            0x7ffff7dd9f60   140737351884640

rbx            0x0  0

rcx            0x0  0

rdx            0x7fffffffe188   140737488347528

rsi            0x7fffffffe178   140737488347512

rdi            0x1  1

rbp            0x7fffffffe090   0x7fffffffe090

rsp            0x7fffffffe090   0x7fffffffe090

r8             0x7ffff7dd8300   140737351877376

r9             0x7ffff7deb9e0   140737351956960

r10            0x7fffffffdee0   140737488346848

r11            0x7ffff7a68be0   140737348275168

r12            0x4003e0 4195296

r13            0x7fffffffe170   140737488347504

r14            0x0  0

r15            0x0  0

rip            0x4004c8 0x4004c8 

eflags         0x246    [ PF ZF IF ]

cs             0x33 51

ss             0x2b 43

ds             0x0  0

es             0x0  0

fs             0x0  0