Then you can next/step as normal. Then next/step backwards.
reverse-next
reverse-step
See the sourceware page for for description. It has a couple links to other wikis that have more info.
Interestingly, there is a direction mode. This might be a good start for the gui.
set exec-direction [forward | reverse]
A modal command: when exec-direction is set to "reverse", all ordinary execution commands
such as "step" and "continue" will cause the program being debugged to run in reverse.
GDB has a nice feature to support reverse debugging. That is, stepping backwards through the code. Add this to the gui.
https://www.sourceware.org/gdb/news/reversible.html
Need to turn on reverse mode.
Then you can next/step as normal. Then next/step backwards.
See the sourceware page for for description. It has a couple links to other wikis that have more info.
Interestingly, there is a direction mode. This might be a good start for the gui.