I am trying to save the value of a register at every execution. I am not sure if record would be the correct fit. I was hoping there is a space to call a hook for every step, or next command.
Inferior control is not yet implemented in GDB Python unfortunately. Hopefully, that will change in the future.
Oops I do apologize, this was about stepping events, not actual stepping. We do have both "stop" and "continue" events. There is indeed no concrete step event. But I suspect a step would just emit a "continue" then "stop" event anyway? https://www.sourceware.org/gdb/onlinedocs/gdb.html#Events-In-Python
One way to do this is attach to stop events. There's a patch pending to add a reason to these, so you can detect "step" stops if you need that for some reason. There's no way to force gdb to single-step on a 'continue' or anything like that though.
In the upcoming gdb-15 release the gdb.StopEvent no has a "details" attribute which contains the reason, which you can access with: event.details['reason'] Which would be 'end-stepping-range' for step events. See docu for more info: https://sourceware.org/gdb/current/onlinedocs/gdb.html/Events-In-Python.html#index-StopEvent_002edetails Is this enough to close this issue?