A historical debugger is able to revert program state (including current instruction) to a former state. How is this possible in managed or unmanaged environments? I can’t imagine that the debugger takes a state shot of the whole system on every instruction.
A historical debugger is able to revert program state (including current instruction) to a
Share
One way to do this is to record the sources of non-determinism in the system (I/O, interrupts) and take state snapshots at various intervals. This way, you can “rewind” by restoring to a previous snapshot and playing forward using the recorded non-determinism until you hit your desired point in the past.
For example, imagine this timeline:
Suppose the user wants to rewind to point 3. You can do that by restoring the system state (e.g. memory, registers) to point 2 and letting the system execute as usual until it hits point 3. When data is needed from disk, the network, or some other non-deterministic source, the historical debugger can use its recorded information to provide the data. To the user, it appears that the state of the program was simply restored to point 3.
I believe this is a simplified view of how VMWare’s Replay Debugger works (see also the tech talk).