How can I see what values the registers hold? I have the following line of assembly:
mov 0x8(%rax), %rax
cpm %ebx, (%rax)
Using the command:
(gdb) p/x $ebx
(gdb) p/x $rbx
$3 = 0xb
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
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
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.
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
hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With