ptrace child after fork?

Bob Mabee rfm at x.UUCP
Sat Nov 23 12:15:26 AEST 1985


In article <755 at rtech.UUCP> daveb at rtech.UUCP (Dave Brower) writes:
>One of the SV machines I am now working with has implemented what they
>have been told is the "correct" behavior of fork() as per the SVID. When
>the fork creates the child, the ptrace status of the parent is passed on
>to the child.  This completely breaks the only debugger (sdb) on
>multiple-process programs, as the child just sits there, ptraced.

This is desirable behavior as it allows you to debug any of the processes
spawned by the one you start with.  UNOS has this feature/bug too.
With CRDS's debugger I use a shell escape to start up another debugger,
telling it to work on the particular child process (can sdb do that?).
We also have a command which makes a suspended process run again
("resume PID &" if you don't want the shell to wait for it).
I need another terminal or a windowing package to debug both processes at
once.

You should not let the parent fork with any breakpoints in place as they
will get duplicated in the child, but the debugger won't know to remove them.
You should put a breakpoint on fork and exec* and single-step through the
system call.
-- 
				Bob Mabee @ Charles River Data Systems
				decvax!frog!rfm



More information about the Comp.unix.wizards mailing list