使用GDB检查寄存器的值 [英] Using gdb to check register's values

查看:1212
本文介绍了使用GDB检查寄存器的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能看到的寄存器保持什么样的价值观?我有装配以下行:

How can I see what values the registers hold? I have the following line of assembly:

 mov 0x8(%rax), %rax
 cpm %ebx, (%rax)

使用命令:

 (gdb) p/x $ebx
 (gdb) p/x $rbx
 $3 = 0xb

我得到存储在该寄存器中的值。然而,当我尝试看看它是存储的int存储位置(%RAX)我有以下问题:

I get the value that is stored in this register. However, when I try to see what it is stored int the memory location (%rax) I have the following problem:

(gdb) display *(int *)$rax
Disabling display 10 to avoid infinite recursion.
10: *(int *)$rax = Cannot access memory at address 0x17

我无法不明白,为什么出现这种情况,此外如何找出(RAX%)在

I cannot not understand why this happens and moreover how to find out what (%rax) has in.

推荐答案

要看到寄存器的值只需要使用

To see the values of the registers just use

print $rax
info register $rax
info register

在你的情况似乎 RAX 包含 0x17已的数量和调试器不能访问此位置。请确保 RAX 包含一个指向一个整数一个有效的地址。

In your case it seems rax contains the number 0x17 and the debugger cannot access this location. Please make sure that rax contains a valid address pointing to an integer.

您应该使用打印而不是显示如果你想采取快速视图。不要滥用显示命令。如果您需要一种看门狗的Ex pression你可以使用它。

You should use print instead of display if you want to take a quick view. Dont abuse the display command. You can use it if you need a kind of watchdog for an expression.

这里你可以找到一个快速参考

Here you find a quick reference

http://www.yolinux.com/TUTORIALS/GDB-Commands.html

希望它帮助。

这篇关于使用GDB检查寄存器的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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