Wednesday, March 26, 2014

Mozilla unveils debugger that works like a VCR

Mozilla unveils debugger that works like a 

VCR

Wednesday, 26 March 2014

Mozilla's 'rr' project lets you record and replay the 

behavior of Linux applications to make debugging 

complex programs much easier


Mozilla unveils debugger that works like a VCR
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 just can't seem to be reproduced in a predictable way, but still 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, etc. -- 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 rr 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 that this degree of slowdown is more than acceptable for the work done with it.
Since rr is a newly minted project -- only just now 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 multi-core 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.

0 comments:

Post a Comment