0

in GDB , i want to save the result of x/x $rsp command , the value inside the address showing

example: the result of the command

 x/x $rsp   is    0xffffaaaa : (0x00400b)

i want to save that address 0x00400b that i highlighted between brackets inside a variable , and reuse that variable that contain 0x00400b inside another GDB command. example dump binary memory from that place when a breakpoint hits.

1 Answers1

2

You can do what you want like this:

(gdb) x/x $rsp
0x7fffffffb000: 0x004011e0
(gdb) set $foo=*((int*) $rsp)
(gdb) p/x $foo
$2 = 0x4011e0
Andrew
  • 3,770
  • 15
  • 22