rr icon indicating copy to clipboard operation
rr copied to clipboard

Cannot continue over exec

Open multun opened this issue 2 years ago • 4 comments

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

multun avatar Nov 27 '23 17:11 multun

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

dzaima avatar Nov 27 '23 17:11 dzaima

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?

multun avatar Nov 27 '23 18:11 multun

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.

dzaima avatar Nov 27 '23 18:11 dzaima

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.

rocallahan avatar Dec 26 '23 19:12 rocallahan