"A light wrapper around rr, the time-travelling debugger

Overview

cargo-rr

Crates.io MIT Licensed

A light wrapper around rr, the time-travelling debugger.

Do you find yourself running the same test over and over in the debugger, trying to figure out how the code got in a bad state? We have a tool for you! Easy to install and setup, it will record an execution trace, and that gives magical new powers to gdb. Step backwards, run backwards, see where variables changed their value or when a function was last called on an object (using conditional breakpoints). (source)

Suppose we ran a test and got a failure. We first re-run the test under rr to record the entire execution (including everything else on your system the test interacts with).

> cargo rr test my_test

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `2`', tests/tests.rs:100

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 2 filtered out; finished in 0.06s

Let's replay the recording.

> cargo rr replay

(rr) continue

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `42`', tests/tests.rs:100

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 2 filtered out; finished in 0.06s

We'll go backwards until we return to the failed assertion so we can have a look at a and b.

(rr) break tests/tests.rs:100
(rr) reverse-continue
Continuing.

Breakpoint 1, tests::main () at tests/tests.rs:100
100         assert_eq!(a, b);

(rr) print a
$1 = 1

(rr) print b
$2 = 42

I wonder where a is set to 1?

(rr) watch -l a
(rr) reverse-continue

Old value = 1
New value = -1992923200
0x000055dcac485ed9 in tests::main () at tests/tests.rs:30
30          let a = some_calculation();

Note that since we're going in reverse the old and new values are backwards. -1992923200 is whatever used to be at the address 0x000055dcac485ed9 before it was used for a.

Comments
  • Unit tests in main.rs (or submodule of main.rs) aren't detected

    Unit tests in main.rs (or submodule of main.rs) aren't detected

    cargo rr test fails when running on a project using cargo workspaces. cargo-rr prouces the following error:

    Error: cargo-rr: No test artifacts built.
    

    I was testing on the following code, for reference: https://git.sr.ht/~zethra/license

    opened by zethra 13
  • Add installation instructions

    Add installation instructions

    I tried my hand at writing some instructions, which could go into the readme.

    While at it, I also made two minor changes to your readme. Feel free to accept or decline those as you prefer!

    opened by grunweg 6
  • Unify `rr-opts` and `gdb-opts` behavior.

    Unify `rr-opts` and `gdb-opts` behavior.

    This is a continuation to #12.

    I think the arguments should have the same syntax for specifying them.

    Now, both can be specified with their specific flag:

    cargo rr replay --rr-opts="-s 1234" --gdb-opts="-a" Note that equal signs are required to eliminate ambiguity. Otherwise clap would parse --rr-opts "-s 1234" as specifying the -s flag.

    In the unified-across-commands branch I have also adjusted the behavior to be consistent, you can decide if that makes sense, given that the other commands do not support gdb-opts and only rr-opts

    opened by DrRuhe 3
  • Can't pass rr-opts

    Can't pass rr-opts

    No matter what I try to do, I can't pass options to rr. For example:

    ❯ cargo rr replay mytrace -s 1234 
    error: Found argument '-s' which wasn't expected, or isn't valid in this context
    
    USAGE:
        cargo rr replay [trace] [rr-opts] [-- <gdb-opts>...]
    
    For more information try --help
    
    opened by NickHu 2
  • No test artifacts built

    No test artifacts built

    Hi, thanks for the rr-wrapper! This is very convenient :) Unfortunately I get an error when trying to run a test: Error: cargo-rr: No test artifacts built.

    Steps to reproduce:

    cargo new --lib bla
    cd bla
    cargo rr test it_works
    
    opened by obraunsdorf 1
  • use other variable to configure log level

    use other variable to configure log level

    The log output will break the interactive selection of cargo rr test. Therefore use other variable so that users that have RUST_LOG set in their development environment can still use it.

    opened by DrRuhe 0
  • Workspaces aren't supported

    Workspaces aren't supported

    I get an error like the following when I try to directly run a test executable

    /home/daniel/.cargo_target/debug/deps/license_codegen-f799eb14e6783cf2: error while loading shared libraries: libtest-a3b2353c72e89634.so: cannot open shared object file: No such file or directory
    
    opened by danielzfranklin 0
Releases(v0.2.0)
Owner
Daniel Franklin
Daniel Franklin
Red Light, Green Light is a traditional Korean children's game, popularised by the Squid Game TV series.

Red Light, Green Light Red Light, Green Light is a traditional Korean children's game, popularised by the Squid Game TV series. This project is the di

Cedric Chee 1 Jan 10, 2022
Avail-light is a data availability light client

avail-light Light client for the Avail blockchain Introduction avail-light is a data availability light client with the following functionalities: Lis

null 7 Apr 9, 2024
Rust SDK wrapper for the Mystic Light SDK

mystic_light_sdk Rust SDK wrapper for the Mystic Light SDK Requirements Any MSI device with RGB support Only Windows 7+ Dragon Center or Msi Center in

null 4 May 3, 2022
Safe and rich Rust wrapper around the Vulkan API

Vulkano See also vulkano.rs. Vulkano is a Rust wrapper around the Vulkan graphics API. It follows the Rust philosophy, which is that as long as you do

null 3.6k Jan 3, 2023
Wrapper around Microsoft CNTK library

Bindings for CNTK library Simple low level bindings for CNTK library from Microsoft. API Documentation Status Currently exploring ways how to interact

Vlado Boza 21 Nov 30, 2021
Thin wrapper around starship.rs to format kakoune status line

kakship is just a thin wrapper around starship to format the status line of kakoune and is meant to be used with the included kakoune script kakship.kak.

Eric Burghard 15 Jun 7, 2022
Wrapper around Microsoft CNTK library

Bindings for CNTK library Simple low level bindings for CNTK library from Microsoft. API Documentation Status Currently exploring ways how to interact

Vlado Boza 21 Nov 30, 2021
📼 Wrapper around ffmpeg which simplifies merging of multiple videos

Vidmerger A wrapper around ffmpeg which simplifies merging of multiple videos. ?? What is this exactly? Vidmerger is a command-line-tool which uses ff

Thomas Gotwig 51 Dec 16, 2022
A super minimal wrapper around unix sockets for IPC on top of tokio.

tokio-unix-ipc This crate implements a minimal abstraction over UNIX domain sockets for the purpose of IPC on top of tokio.

Armin Ronacher 26 Nov 18, 2022
Wrapper around reqwest to allow for client middleware chains.

reqwest-middleware A crate implementing a wrapper around reqwest to allow for client middleware chains. Overview The reqwest-middleware client exposes

TrueLayer 113 Dec 7, 2022
A stupid wrapper around Meilisearch 🐻

Mieli ?? Usage ?? mieli 0.1.10 A stupid wrapper around meilisearch USAGE: mieli [OPTIONS] <SUBCOMMAND> FLAGS: -h, --help Prints help i

Irevoire 16 Aug 5, 2022
A wrapper around the Win32 API credential management functions.

wincredentials-rs A wrapper around the Win32 API credential management functions. Currently only supports generic credentials. Example use wincredenti

null 3 Apr 4, 2022
A wrapper around SDL2's game controller API.

fishsticks System for handling gamepad input, using SDL2's game controller API as the backend. License Fishsticks is dual-licensed under either Apache

null 7 Dec 8, 2022
Deno wrapper around minifb, for making a framebuffer you can draw pixels to

deno minifb This is a thin wrapper around minifb that you can use in deno. Combine it with canvas for native window that works like the canvas web API

David Konsumer 9 Feb 18, 2022
Wrapper around atspi-code to provide higher-level at-spi Rust bindings

atspi Wrapper around atspi-codegen to provide higher-level at-spi Rust bindings. Contributions Take a look at our atspi-codegen crate, and try inpleme

Odilia 3 Feb 7, 2022
FFI wrapper around cfitsio in Rust

rust-fitsio FFI wrapper around cfitsio in Rust Installation fitsio supports versions of cfitsio >= 3.08. cfitsio must be compiled with reentrant suppo

Simon Walker 22 Dec 24, 2022
cargo-check This is a wrapper around cargo rustc

cargo-check This is a wrapper around cargo rustc -- -Zno-trans. It can be helpful for running a faster compile if you only need correctness checks. In

Ray Solomon 99 Oct 13, 2022
Shared memory - A Rust wrapper around native shared memory for Linux and Windows

shared_memory A crate that allows you to share memory between processes. This crate provides lightweight wrappers around shared memory APIs in an OS a

elast0ny 274 Dec 29, 2022
A safe Rust wrapper around a subset of cuFFT.

cufft_rust This is a safe Rust wrapper around CUDA FFT (cuFFT). It only supports a subset of the API which I need for private projects. For now this o

Pim van den Berg 1 Jan 11, 2022
A simple, yet feature-filled wrapper around the coqui-stt C API

A simple, yet feature-filled wrapper around the coqui-stt C API

0/0 56 Jan 3, 2023