Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show processes that exec'd but did not fork in rr ps (and support them with -p) #3895

Open
Keno opened this issue Jan 8, 2025 · 1 comment

Comments

@Keno
Copy link
Member

Keno commented Jan 8, 2025

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.

@khuey
Copy link
Collaborator

khuey commented Jan 8, 2025

Yeah this would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants