[I will be at GUADEC from tomorrow evening. See you in Manchester!]
In the previous post I talked about the technology behind UndoDB, in this last post of the series I will talk about replaying recorded programs.
Debugging programs with the ability to go backwards is really useful, but what about automated tests? How about bugs that happen only for a specific user but you cannot reproduce?
Saving recordings helps here. Using Live Recorder you can save the complete status and execution history of a process (including debug symbols) and debug it using UndoDB on another machine with the same architecture.
Live Recorder can be used as a standalone program (
live-record -o recording.undo my-program) or as a library.
Using it as a library allows the programmer to start/stop recording when they want, for instance recording only the execution of a test but not the test set up.
The API is quite simple to use, for instance, to record a program until its execution ends, you can just do:
// Start recording. undolr_start(NULL); // Automatically save when the program exits. // This saves also if the program crashes or terminates // due to an uncaught signal. undolr_save_on_termination("/foo/bar/recording.undo");
This is particularly useful for tests, in particular tests which fail due to a rarely occurring bug.
You can record your test execution and, if the test fails, save the recording for later debugging. Otherwise, you can just discard the recording.
See the Undo website if you want to try UndoDB and Live Recorder.
One thought on “Dealing with program recordings”