rr
rr copied to clipboard
Cannot continue over exec
When running a shell script which execs a binary, nothing gets printed on stdout with rr replay.
Environment
Tested on an Haswell laptop, on master and the last release
Reproducer
cat >hello-world.c <<EOF
#include <stdio.h>
int main() {
puts("hello world");
return 0;
}
EOF
make hello-world
cat >wrapper.sh <<EOF
#!/bin/sh
exec "./hello-world"
EOF
chmod +x wrapper.sh
rr record ./hello-world
rr replay
# hello world gets printed to stdout
rr record ./wrapper.sh
rr replay
[SNIP]
(rr) continue
# nothing
The problem is that rr is unable to continue over exec... syscalls; a workaround I've used before is to run when-ticks, and do seek-ticks (result of when-ticks plus one), but it's still funky. Haven't looked into why.
Related issue (which doesn't happen as-is anymore due to it now freezing on the exec, but using the seek-ticks thing it still results in 'g' packet errors): https://github.com/rr-debugger/rr/issues/2961
The linked issue says something about 32 / 64 bits transitions, and this example doesn't involve anything like it. Didn't it work at some point?
Wouldn't be surprised if it worked before, as it seems that in that issue it indeed continued over the exec transition, but it doesn't anymore.
I think continuing through exec has never worked with rr.
It might be possible to fix this. gdb can do it. I don't know what we'd have to do in rr.