Using RR

RR is a recording tool that allows reverse debugging. RR is pretty fast and might be easier to use than gdb record.

More details on RR:

Since RR uses low level CPU performance timers to record data, it does not work on some types of processors and some VMs. It has been confirmed to work on Intel chips newer than 2010 and in VMWare (if the host supports it).


These instructions are for Ubuntu. Your favorite distro might be different.

You will need to install performance monitoring tools:

apt-get install linux-tools-common linux-tools-generic linux-tools-`uname -r`

Also install a C++ compiler and toolchain:

apt-get install g++ build-essential cmake

Install rr:

apt-get install rr-project


To use rr, just run your program while recording:

rr record ./a.out

Once you are done running your program or it crashes, you can replay its execution:

rr replay

You will then be in a gdb like environment and can issue normal gdb commands. Most importantly, you have access to the reverse versions of the step, next, finish, and continue commands.


RR can be hard to get to work, depending on your distro's configuration. Running the record session as root might fix some issues:

sudo rr record ./a.out

You can also record in a slower, but more compatible mode:

rr record -n ./a.out

Try it out

If your machine supports it, try using RR on the simpletree demo. You can add bugs by removing mallocs, adding incorrect frees, or removing initializations.