为什么"信息注册EBP"在gdb中不显示十进制数? [英] Why is "info register ebp" in gdb not displaying a decimal number?

查看:145
本文介绍了为什么"信息注册EBP"在gdb中不显示十进制数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我调试一个非常简单的code使用gdb:

I am debugging a very simple code with gdb:

mov ebp,eax     ; Save # of bytes read from file for later

下面是我的输出:

Breakpoint 2, Read () at hexdump1.asm:44
(gdb) info register eax
eax   0xd      13
(gdb) step
Read () at hexdump1.asm:45
(gdb) info register ebp
ebp   0xd      0xd

为什么GDB显示我要EAX但0xd中0xd中的EBP 0xd中13?

Why is gdb showing me 0xd 13 for eax but 0xd 0xd for ebp?

推荐答案

您的问题是为什么(GDB)信息寄存器EAX 显示EAX与十六进制和内容十进制数,而(GDB)的信息登记EBX 只使用十六进制数字的EBP,对吧?

Your question is why (gdb) info register eax displays the content of EAX with a hex and a decimal number, while (gdb) info register ebx only uses hex numbers for EBP, right?

这不仅是EBP的情况下,也为ESP,EFLAGS和EIP,太。我认为,没有任何特殊含义。 GDB只是试图在一个有用的方式来显示它。例如,对于EFLAGS,你想看到的标志的状态,而不是一个十进制数(在下面如果示例设置)。在EBP和ESP的情况下,我们都在谈论它通常用来指向堆栈/存储器中的地址寄存器。因此通常情况下,你不想知道的十进制值。好了,在这种情况下,呈现出六角两次没什么用处,但。

That is not only the case for EBP, but also for ESP, EFLAGS and EIP, too. I think, that has no special meaning. gdb just tries to display it in a usefull way. For example for EFLAGS, you want to see the status of the flags and not a decimal number (in the example below IF is set). In the case of EBP and ESP, we are talking about registers which are usually used to point to an address in the stack/memory. Thus normally, you do not want to know the decimal value. Okay, in this case, showing hex twice is quite useless though.

下面是显示所有寄存器与信息寄存器内容的例子命令( IR 是短形式,我只是发现了:P)

Here is an example which displays the content of all registers with the info registers command (i r is the short form, I just found out :P).


    (gdb) i r
    eax            0x0  0
    ecx            0x0  0
    edx            0x0  0
    ebx            0x0  0
    esp            0xbffff234   0xbffff234
    ebp            0x0  0x0
    esi            0x0  0
    edi            0x0  0
    eip            0x804822d    0x804822d 
    eflags         0x202    [ IF ]
    cs             0x73 115
    ss             0x7b 123
    ds             0x7b 123
    es             0x7b 123
    fs             0x0  0
    gs             0x0  0

更多的相关信息: https://sourceware.org/gdb/onlinedocs/gdb/Registers html的

这篇关于为什么"信息注册EBP"在gdb中不显示十进制数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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