Skip to content

Instantly share code, notes, and snippets.

@spacejam
Created September 24, 2017 18:22
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spacejam/0ec039d4b3bb0ac976245975de8f3a25 to your computer and use it in GitHub Desktop.
Save spacejam/0ec039d4b3bb0ac976245975de8f3a25 to your computer and use it in GitHub Desktop.
pretty printing rust with rr

using rust pretty printers with rr

rr is a great debugging tool. it records a trace of a program's execution, as well as the results of any syscalls it executes, so that you can "rewind" while you debug, and get deterministic forward and reverse instrumented playback. it works with rust, but by default if you try it out, it could be pretty ugly when you inspect variables.

install

steps:

  1. get the rust pretty printer python script
  2. configure gdb to automatically load it

~/.gdbinit:

python                                                                                                                                                                                                                                                         
import sys  

# set this to the path of the pretty printer
sys.path.insert(0, '/path/to/src/rust/src/etc/')

import gdb_rust_pretty_printing                                                                                                                                                                                                                                

gdb_rust_pretty_printing.register_printers(gdb)                                                                                                                                                                                                                
end  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment