Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

PSA: rr is amazing

Added by Todd Strader 7 months 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. https://rr-project.org/

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 input.vc \+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 7 months 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 7 months 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 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS" 
$ uname -r
4.18.0-25-generic
$ 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: https://github.com/mozilla/rr/wiki/Building-And-Installing

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.

    (1-2/2)