Time travel is here, at least when it comes to debugging
At CppCon 2017, the Time Travel Debugging team (TTD) came through with a present for all the developers out there: A reverse debugging tool!
- Time Travel Debugging in WinDbg Preview!
- Time Travel Debugging presentation at CppCon. Watch the presentation here.
- Time Travel Debugging FAQ.
Time Travel Debugging captures a trace of the program being executed so that the run can be replayed later. When you load the trace in the debugger, you can jump to any point in the program’s execution, be it forward or backward. Single-stepping backward through the code lets you trace backward where a bad value came from. You can set write breakpoints on memory and then ask the program to execute backward: The breakpoint will fire when the memory was previously written. Again, this lets you trace backward where a bad value came from.
(As noted in the talk, this is similar in many ways to the rr project, but differs in many was as well.)
Bonus chatter: I helped out with the replay portion of this project some time ago. I wrote the second version of the jitter’s register allocator, as well as implementing some of the opcodes. I’m told that some of my code has since been removed, but other parts remain.