3

I am new to assembly and I am trying to print a value stored in the following address.

 cmp    %esi,0x10(%rsp,%rax,4) 

I think it is something like

 x/d $rsp+ 0x10 + 4*$rax
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
a_a_a
  • 283
  • 1
  • 11
  • 1
    Yes, that is correct. To be sure, specify data size or else gdb will default to the one previously used which might not be dword. – Jester Oct 25 '18 at 22:12
  • 1
    Your question title doesn't match your question. To print a register, use `p /x $rax` – Peter Cordes Oct 26 '18 at 00:14

1 Answers1

4

This is the correct way to print the contents of a memory location.

x/d $rsp+ 0x10 + 4*$rax
prl
  • 11,716
  • 2
  • 13
  • 31
a_a_a
  • 283
  • 1
  • 11