[Google]
 
WebLinuxElectrons™

New Linux Debugger Can Run Programs Backwards

ApplicationUndo Software today unveiled UndoDB — the first bidirectional debugger for compiled programs.

A bidirectional debugger allows programmers to run a program backwards in time as well as forwards. The program can be stepped back line-by-line, or rewound to any point in its history. Furthermore, programmers can play the program forwards and backwards in a totally repeatable fashion, allowing them to "home in" on the cause of a bug.

Bidirectional debuggers are much more powerful than their traditional counterparts, which only allow programmers to step their programs forwards in time. This is particularly true for bugs whose root cause occurs long before the ill effects manifest themselves, and for bugs that occur only intermittently.

Bidirectional debugging means bugs that would normally take days to uncover can be found in minutes.

Although bidirectional debugging has proved highly effective for Java programs, until now has it not been available to programmers using compiled languages such as C and C++. This is somewhat ironic, since lower-level languages like C and C++ can be much more bug-prone than their higher-level counterparts. However implementing a bidirectional debugger for arbitrary binaries presents a much more difficult problem than implementing one for interpreted or 'byte-code' languages, where the interpreter can be extended to record all state changes as the program executes. UndoDB uniquely enables bidirectional debugging of arbitrary Linux binary programs, including those written in C or C++. UndoDB requires no recompilation or other modifications to the program being debugged, nor does it require any specialized hardware, kernel patches, or kernel modules.

"UndoDB makes even the nastiest bugs trivial to uncover," says Julian Smith, co-founder of Undo Software. "This is hugely significant, because the unfortunate reality is that most programmers spend most of their time hunting a few nasty bugs. A tool that could reduce the debugging burden by even a few percent would save the software industry a staggering amount of time and money; and UndoDB can do much, much better than that."

Bidirectional debugging is so useful because it gives the user control over time. To debug a program is to reason backwards from the point of failure to determine the cause of that failure. On the first page of their book, The Practice of Programming, Brian Kernighan and Rob Pike give the following advice to programmers when debugging:

"Reason back from the state of the crashed program to determine what could have caused this. Debugging involves backwards reasoning, like solving murder mysteries. Something impossible occurred, and the only solid information is that it really did occur. So we must think backwards from the result to discover the reasons."

With this analogy, a programmer using a bidirectional debugger is like the detective finding detailed CCTV footage not just of the murder itself, but also all pertinent events that led to the murder.

UndoDB uses the ubiquitous gdb as its front-end, so Linux developers will feel right at home, and be productive the moment they get started. gdb has been complemented with a few new commands which work just like gdb's existing commands, only they step the program backwards in time, rather than forwards. For example, whereas gdb's step command steps the program forwards one source line, UndoDB's bstep command steps the program back one source line. UndoDB also compliments gdb's next, until, finish, stepi and nexti commands with their backwards counterparts: bnext, buntil, bfinish, bstepi and bnexti, respectively. UndoDB also adds some new commands which have no parallel in gdb, such as the bgoto and bgoton commands, which jump to an arbitrary point in the program's history. When the program is paused at any point in its history, the programmer can inspect the full state of their program using the usual gdb commands (e.g. print, backtrace and display).

The company is unusual in that it has chosen Linux as the first operating system on which its proprietary product runs. Julian Smith explains "We did this for several reasons. Today's Linux market is pretty exciting, not least due to its rapid expansion into Consumer Electronics and other embedded systems. We believe that the somewhat fragmented nature of the Linux market makes it more accessible for small but innovative companies such as ourselves. There were also technical considerations — for example, UndoDB's technology requires a precise and complete specification of the application/kernel interface, and you can't get a more precise and complete specification than the kernel's source code!".

Although UndoDB is not open source, developers who don't get paid for their work can use UndoDB for free. For professional use, UndoDB retails for $495 per seat, with an introductory special offer of $295, plus a fee upgrade to version 2 when that is released (currently slated for Q4 this year). There is also a free 30-day evaluation version. UndoDB is available now, from
http://undo-software.com.

References
[1] Dr. Dobb's Journal, May 09, 2005 — Omniscient Debugging (RetroVue at Work)
http://www.ddj.com/dept/debug/184406101?pgno=5.