Dennis
Dennis

Reputation: 1065

Link commands in gdb to observe the execution stack

I am looking for a program to observe the execution stack of a c/c++ program. Currently I am using gdb for this purpose.

The following command shows the content of the stack:

x/12xg $rsp

to execute instruction after instruction I am using

stepi

Is it possible to combine these to commands so that I would be able to stept through the assembly code and observing the stack? If you have another possible solution/program I am looking forward to hear that as well.

Upvotes: 1

Views: 94

Answers (1)

Tom Tromey
Tom Tromey

Reputation: 22519

You can combine commands using define, like:

(gdb) define mystep
> stepi
> x/whatever $rsp
> end

Now mystep should step and then dump some memory.

Upvotes: 2

Related Questions