Reputation: 2182
I am trying to set up a python script in gdb that steps through a program one line at a time and records the stack pointer at each step. I have been searching all over for some good online references for gdb-python scripting and have not been able to find any that are worthwhile.
A script example or a link to a good online reference for gdb-python scripting would be appreciated.
Upvotes: 0
Views: 197
Reputation: 22519
You can do this even from the gdb command line:
while 1
step
# Do something with $sp
end
The Python version would look similar, something like:
while True:
gdb.execute("step")
sp = gdb.parse_and_eval("$sp")
# Do something with sp.
Upvotes: 1