1

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 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.