Major Tools
Other Tools
General Info

PSA: rr is amazing

Added by Todd Strader about 1 year ago

I've been using rr instead of (on top of?) gdb to debug Verilator and it's pretty awesome. It records the execution of a process and then gives you deterministic replay of that recording. This includes memory locations, so you can run it once, find interesting nodes and then run again and trap on construction or destruction of those nodes. You can also trace backwards to see when something in memory was changed.

I'll have to add an option to the Verilator perl wrapper, but for now to record something, verilate with the --debug flag and then copy out the command line that is echoed with "verilator_bin_dbg" and add that to "rr record". E.g.:
rr record /foo/bar/bin/verilator_bin_dbg --prefix Vt_generate_fatal_bad --x-assign unique -cc -Mdir obj_vlt/t_generate_fatal_bad -OD --debug-check --comp-limit-members 10 --lint-only --clk clk -f \+define\+TEST_OBJ_DIR\=obj_vlt/t_generate_fatal_bad --debug --no-skip-identical t/t_generate_fatal_bad.v

Replies (2)

RE: PSA: rr is amazing - Added by Wilson Snyder about 1 year ago

Nice. It looks like it can run under gdbgui which is worth trying as that would be a great pairing.

After an rr record of a _dbg_bin run, a rr_replay shows no symbols. Any idea?

RE: PSA: rr is amazing - Added by Todd Strader about 1 year ago

Neat, I hadn't seen gdbui before. I'll have to check that out.

I'm not sure about your issues. I've used rr to debug Verilator both at work and on my personal machine and it just worked. I do know that it requires a modern-ish CPU and OS. I'm running this on my laptop:
$ cat /etc/lsb-release 
$ uname -r
$ cat /proc/cpuinfo  | head -n 5
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 78
model name      : Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz

And I should have mentioned before that you probably want to set /proc/sys/kernel/perf_event_paranoid to 1 so that rr can use the performance counters:

But I don't see why any of that would impact your ability to see the symbols.

rr caches runs under .local/. Perhaps rr replay is picking up a non-debug run for some reason? I might try to blow away rr's .local stash.