GDB has a new version out that supports reverse debug (see http://www.gnu.org/software/gdb/news/reversible.html). I got to wondering how that works.
To get reverse
Here is how another reverse-debugger called ODB works. Extract:
Omniscient Debugging is the idea of collecting "time stamps" at each "point of interest" (setting a value, making a method call, throwing/catching an exception) in a program and then allowing the programmer to use those time stamps to explore the history of that program run.
The ODB ... inserts code into the program's classes as they are loaded and when the program runs, the events are recorded.
I'm guessing the gdb one works in the same kind of way.