News for hackers. Stuff that matters.
Re:What rr does by ris58h on Saturday June 04, 2022 @05:09AM (#31618402)
Could you next time provide some small but meaningful description in the title? "Rr" is a little bit short in my opinion.
Re:What rr does by asicsp on Saturday June 04, 2022 @05:25AM (#31618485)
For those reading the above comment, but hadn't clicked the article link yet (like me):

>rr aspires to be your primary C/C++ debugging tool for Linux, replacing — well, enhancing — gdb. You record a failure once, then debug the recording, deterministically, as many times as you want. The same execution is replayed every time.

>rr also provides efficient reverse execution under gdb. Set breakpoints and data watchpoints and quickly reverse-execute to where they were hit.

Re:What rr does by mlochbaum on Saturday June 04, 2022 @07:41AM (#31619207)
It also becomes a bit of a cheat in terms of HN points, as mobile users miss the link and hit the up arrow next to it.

https://news.ycombinator.com/item?id=30906989

Re:What rr does by kzrdude on Saturday June 04, 2022 @05:56AM (#31618643)
The RR debugger
Re:What rr does by pvinis on Saturday June 04, 2022 @05:33AM (#31618514)
maybe "rr, a gdb replacement"
Re:What rr does by bajsejohannes on Saturday June 04, 2022 @05:44AM (#31618584)
That feels like it's underselling it a bit, since gdb does not have reverse execution, which is a pretty major contribution by rr.
Re:What rr does by ncmncm on Saturday June 04, 2022 @06:12AM (#31618703)
AIUI, Gdb does claim reverse execution, for certain targets. So, there are differences, but I don't understand them.
Re:What rr does by ynik on Saturday June 04, 2022 @06:21AM (#31618752)
gdb's reverse execution is incredibly slow.

Performance overhead of reverse debuggers:

* gdb: >1000x (note: I never tested this one myself; just heard about this overhead in a HN comment a long time ago)

* Microsoft WinDbg TimeTravel Debugger: >40x

* rr: 1.5x

rr is the only one fast enough to be used on a regular basis -- the others are slow enough that they only make sense on particularly nasty bugs (usually memory corruption)

Re:What rr does by zempfel on Saturday June 04, 2022 @09:19AM (#31619971)
I would be surprised if the overhead of TTD is typically 40x, given that it records multithreaded processes in parallel. Which, to my knowledge, rr does not.

It also supports selective recording so, if this is configured (e.g. selecting certain functions), only a subset of the process execution is actually committed to the trace file, further reducing the overhead.

Re:What rr does by ynik on Saturday June 04, 2022 @12:44PM (#31622501)
I don't know about multithreaded processes -- the program I use it is single-threaded. My main use case is not to make the crashes reproducible (they usually already are), but to understand where a bogus value is coming from. (memory breakpoint + run backwards) Which often ends up being a certain third-party library that makes liberal use of C unions, sometimes accessing the wrong variant...

I'll have to look into selective recording, but I'm not sure how helpful it'll be in my use case (I don't know said library well enough to predict which functions might be causing the bogus values)

Re:What rr does by ncmncm on Saturday June 04, 2022 @08:36PM (#31626704)
Would we recognize the blamed library?
Re:What rr does by fanf2 on Saturday June 04, 2022 @07:32AM (#31619151)
There is also a commercial alternative, https://undo.io/solutions/products/udb/ though I have not used it myself and I don’t know what its overhead is. (I know some of the people who work on it.)
Re:What rr does by db48x on Saturday June 04, 2022 @11:55AM (#31621864)
Using GDB’s reverse execution requires you to already be pretty sure where the bug you are looking for is, and then recording a very short portion of the program, preferably just 10k instructions or so. Recording for a whole second could easily take 15 minutes. But it does work well, within those limitations.
Re:What rr does by jcranmer on Saturday June 04, 2022 @09:15AM (#31619935)
gdb claims it. I have not once ever gotten it to work, however. For anything seemingly larger than a trivial program, the reverse-execution state grows too big and needs to be pruned. I also don't think it supports such fancy things as "floating point".
Re:What rr does by teddyh on Saturday June 04, 2022 @12:16PM (#31622140)
> gdb does not have reverse execution

GDB does have reverse execution:

https://sourceware.org/gdb/current/onlinedocs/gdb/Reverse-Ex...

Re:What rr does by sph on Saturday June 04, 2022 @06:06AM (#31618676)
It doesn't look like it's a replacement, it's more a companion tool for gdb to deterministically record, replay and debug a process after the fact.
Re:What rr does by db48x on Saturday June 04, 2022 @11:57AM (#31621888)
Yea, I wouldn’t call it a replacement. It acts as a GDB debugging target; basically you connect a GDB process to rr and GDB controls rr for you. (To confuse things further, the “rr replay” command starts both rr and GDB for you, so it can be difficult to see the seams.)
Re:What rr does by mmarq on Saturday June 04, 2022 @07:40AM (#31619193)
Can I edit it?
Re:What rr does by pvg on Saturday June 04, 2022 @09:12AM (#31619904)
You could but really the title is fine, just like reposting after sufficient time is fine. It's ok for a title to require a click.
Re:What rr does by kzrdude on Saturday June 04, 2022 @09:11AM (#31619887)
Normally yes, but maybe not so late after submission. Moderators can update it.