In GDB how do I print 0xc(%rsp)?
I saw the above link to print the value when there's two arguments there, but what do I do when there's three? What to do with the offset 1?
How to find the address of (%r12,%rbx,1) and print its content?
In GDB how do I print 0xc(%rsp)?
I saw the above link to print the value when there's two arguments there, but what do I do when there's three? What to do with the offset 1?
How to find the address of (%r12,%rbx,1) and print its content?
Copyright © 2021 Jogjafile Inc.
In x86/x86-64 AT&T syntax the addresses are of the form
displacement(basereg, indexreg, scale)
. That is computed to an address as displacement+basereg+indexreg*scale where scale is 1, 2, 4, or 8. You can leave any part of the equation off. In GDB you canprint
the address from such an expression using theprint
command. For example address 0x28(%rdx, %rsi, 4) could be printed with GDB with:If you want to print out what is at such an address you can use GDB's
x
(examine) command. To print the string at that address out you can use:To display a byte at that address in hexadecimal:
To display the 12 16-bit signed values starting at that address in decimal:
To display the 6 32-bit unsigned values starting at that address in decimal:
To display the 3 64-bit values starting at that address in hexadecimal:
Review the complete documentation for the eXamine command at the link provided earlier for a complete description of the command and its parameters.
In your example you don't have a displacement so it is assumed to be 0. The GDB expression for
(%r12,%rbx,1)
is0+$r12+$rbx*1
which can be simplified to$r12+$rbx