rr icon indicating copy to clipboard operation
rr copied to clipboard

rr delta/diff

Open grandinj opened this issue 6 years ago • 3 comments

My apologies if this request is a little "out there", feel free to close it if so.

My use-case: I have a bug. I know which change caused this bug. (right down to the exact line) However, this change causes tons of subtle ripple effects in the execution of my program, such that, by the time an assert trips, I am far away from the start of the problem.

What I want is to do 2 runs of RR, 1 before and 1 after the patch.

Then I want to run some kind of 'rr delta' program, which will tell me the earliest point at which the execution of the two traces begins to diverge.

Likely this will also need: () some kind of 'ignore and continue' command to skip the boring stuff that is slightly out of order () some kind of 'only consider these threads' as interesting (*) some kind of 'ignore filter' to ignore whole swaths of source code where the differences are uninteresting.

grandinj avatar Jun 11 '19 13:06 grandinj

That's a good idea that I've been thinking about for a long time. It would be a cool research project. Unfortunately I don't have the time to work on it.

You might be able to hack something together with gdb that works in some cases.

rocallahan avatar Jun 11 '19 22:06 rocallahan

drltrace from dynamorio can generate a log of shared library calls, and for the main binary you can print __builtin_return_address(0) from gcc's -finstrument-functions callbacks and resolve addresses to symbols using llvm-symbolizer or similar. Then diff the logs. This is all at function call granularity though.

harjoc avatar Aug 06 '19 19:08 harjoc

As something close, one can call rr dump for different executions, which contains a lot of events (mostly syscalls though), then reduce the difference by using grep and co, and compare with diff and e.g. diffr.

Hi-Angel avatar Jul 02 '23 14:07 Hi-Angel

This would be an awesome functionality for writing deterministic programs.

travisdowns avatar Sep 10 '25 18:09 travisdowns