質問

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.

役に立ちましたか?

解決

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.
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top