Mozilla unveils debugger that works like a VCR

Mozilla's Rr project lets you record and replay the behavior of Linux applications for easier debugging of complex programs

Debugging is nobody's favorite part of programming, and the larger and more complex the app, the more difficult the debug job. Worse, some bugs can't seem to be reproduced in a predictable way, but buzz out often enough to be a disaster.

Mozilla's new debugger, called Rr, was devised to address this problem. Originally written to aid with the debugging of Firefox, the program works by recording an application's execution, as one might record a TV program, then replaying the recording -- which can be single-stepped, reversed, and so on -- and using that playback to perform the debugging deterministically.

"The memory layout is always the same [for the recorded program]," says Mozilla. "The addresses of objects don't change, register values are identical, syscalls return the same data, etc."

Aside from making difficult-to-reproduce bugs easier to track down, Mozilla claims Rr can make the entire debugging cycle less painful. For instance, when combined with fuzzers, the programmer can see in detail how the fuzzed input causes a problem. Large projects -- like Firefox -- with a large roster of unit tests can have any individual failures generated by those tests sifted out and debugged on their own.

Mozilla claims the total amount of performance overhead introduced by using Rrr is relatively small, with slowdowns of around 1.25 to 3 times normal execution speed, with most of the slowdowns at around a factor of 1.2. The company claims Rr could in theory be made faster, but this degree of slowdown is more than acceptable for the work done with it.

Since Rr is a newly minted project -- currently a 1.0 release -- it's limited in many ways. The single biggest limitations are platform and architecture: It only debugs 32-bit Linux x86 processes, although a port to x86-64 is promised in the future. There's no word yet about whether Rr could be ported to Windows, but odds are it would require some major reworking. Haswell CPUs aren't supported yet, and ports to ARM are currently out of the question, since Mozilla claims that ARM processors don't have the needed performance counter features to support the program.

Also, Rr can only emulate a single core, so any programs with bugs that arise from multicore parallelism probably won't be debuggable with Rr. The same goes for programs that use shared memory, since Rr can't record anything outside of the process it's capturing.

Mozilla has released Rr under an MIT-like license, with the source available at GitHub.

This story, "Mozilla unveils debugger that works like a VCR," was originally published at Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow on Twitter.