如何在x86-64中从gdb访问r8-r15的低字节寄存器? [英] How do you access low-byte registers for r8-r15 from gdb in x86-64?

查看:78
本文介绍了如何在x86-64中从gdb访问r8-r15的低字节寄存器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在gdb中,我似乎无法访问任何伪寄存器: r8b r9b r10b r11b r12b r13b r14b r15b (不过, r15d r15w 似乎有效,并且对于 sil 也是如此.

In gdb, I can't seem to access any of the pseudo-registers: r8b, r9b, r10b, r11b, r12b, r13b, r14b, nor r15b (however, r15d and r15w seem to work, and same for sil).

查看示例:

section .text
global main

main:
  xor esi, esi
  mov sil, 0x1f
  xor r13d, r13d
  mov r13b, sil
  ret

使用 gdb 运行:

(gdb) p $sil
$1 = -15
(gdb) p $r13 
$2 = 241
(gdb) p $r13b
$3 = void
(gdb) p /x $r13b
$4 = 0x0

我在 gdb中找不到任何内容手册,并且没有使用 info all-registers 命令进行打印.我正在使用GDB 10.

I couldn't find anything in the gdb manual, and they aren't printed with the info all-registers command. I'm using GDB 10.

推荐答案

您可以使用后缀 l 引用这些寄存器的低字节:

You can reference to the low byte of those registers using the l suffix:

r8l r9l r10l r11l r12l r13l r14l r15l .

(gdb) p $r13l
$1 = -15
(gdb) p /x $r13l
$2 = 0xf1

除了在此外,在gdb代码库中,是一个错误如果在 print 命令中指定了格式,则使用0而不是void(如上例所示).如果未定义您要打印的值,则将来的gdb版本应显示 void .

Furthermore, there was a bug in the gdb codebase that would print 0 instead of void if a format is specified to the print command, as it happens in the last example. Future versions of gdb should display void if the value that you are printing is not defined.

这篇关于如何在x86-64中从gdb访问r8-r15的低字节寄存器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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