[英]How to print a character at a particular offset within a register?
I just wanted to know if there was a command within the Unix gdb debugger to print an individual character at a particular offset in the register.我只是想知道 Unix gdb 调试器中是否有一个命令可以在寄存器中的特定偏移量处打印单个字符。
For instance,例如,
If I wanted to know what character of a string was in 0x9(%rdi)
how would I display that?如果我想知道字符串的哪个字符在
0x9(%rdi)
我将如何显示它?
would it be something similar to x/c $rdi,9
?它会类似于
x/c $rdi,9
吗?
Thanks谢谢
I guess you need not at an offset "within" a register, but rather you need to read memory pointed to by a register, with a given offset.我猜您不需要在寄存器“内”的偏移量处,而是需要读取寄存器指向的内存,并具有给定的偏移量。 This can be done this way:
这可以通过以下方式完成:
x/c $rdi+9
Generally, the address for the x
command is just an expression with a numeric value.通常,
x
命令的地址只是一个带有数值的表达式。 The $rdi
here is simply the value of the register RDI
, to which the constant 9
is added.这里的
$rdi
只是寄存器RDI
的值,常量9
被添加到该寄存器中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.