Show processes that exec'd but did not fork in `rr ps` (and support them with -p)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.7k
- Forks
- 662
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 2
Description
When a process exec's but does not fork, it can be confusing for users to know how to attach to the process they want. E.g. consider:
$ cat ls.sh
#!/bin/sh
exec ls
$ chmod +x ./ls.sh
$ rr record ./ls.sh
$ rr ps
PID PPID EXIT CMD
3636445 -- 0 ./ls.sh
$ rr replay
(rr) c
Continuing.
Program stopped.
0x0000000070000002 in syscall_traced ()
(rr) bt
#0 0x0000000070000002 in syscall_traced ()
#1 0x00007cebe9815198 in _raw_syscall () at /home/keno/rr/src/preload/raw_syscall.S:120
#2 0x00007cebe980ffb9 in traced_raw_syscall (call=0x681fffa0) at /home/keno/rr/src/preload/syscallbuf.c:379
#3 0x00007cebe9812f38 in sys_fstatat (call=<optimized out>) at /home/keno/rr/src/preload/syscallbuf.c:3716
#4 syscall_hook_internal (call=0x681fffa0) at /home/keno/rr/src/preload/syscallbuf.c:4340
#5 syscall_hook (call=0x681fffa0) at /home/keno/rr/src/preload/syscallbuf.c:4379
#6 syscall_hook (call=0x681fffa0) at /home/keno/rr/src/preload/syscallbuf.c:4363
#7 0x00007cebe980f2e3 in _syscall_hook_trampoline () at /home/keno/rr/src/preload/syscall_hook.S:308
#8 0x00007cebe980f34d in __morestack () at /home/keno/rr/src/preload/syscall_hook.S:443
#9 0x00007cebe980f354 in _syscall_hook_trampoline_48_3d_01_f0_ff_ff () at /home/keno/rr/src/preload/syscall_hook.S:457
#10 0x00007cebe94eef41 in __GI_execve () at ../sysdeps/unix/syscall-template.S:120
i.e. gdb stops in the shell's execve code. Experienced users will know how to find event numbers and get past this, but new users may not. I think we should consider extending rr ps to also show exec events, e.g.
PID PPID EXIT CMD
3636445 -- exec ./ls.sh
3636445.1 -- 0 ls
and then let users get to the post-exec state with rr replay -p 3636445.1 etc.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the rr ps and rr replay -p entry points described in the issue, then reproduce the exec-without-fork example. Trace how process rows and replay targets are selected; done means rr ps shows both the pre-exec and post-exec states and rr replay -p 3636445.1 reaches the post-exec state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- cli, devtools, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100