Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!uxc.cso.uiuc.edu!tank!uwvax!astroatc!glen From: glen@astroatc.UUCP (Glen Ecklund) Newsgroups: comp.unix.wizards Subject: Re: Debugging Child Processes. Message-ID: <2703@astroatc.UUCP> Date: 28 Aug 89 21:47:19 GMT References: <6840004@hpcllcm.HP.COM> Reply-To: glen@astroatc.UUCP (Glen Ecklund) Organization: Astronautics Technology Cntr, Madison, WI Lines: 23 In article <6840004@hpcllcm.HP.COM> pratap@hpcllcm.HP.COM (Pratap Subrahmanyam) writes: >if((pid = fork()) == 0) { > >/* How can you step into this area ???? */ > >} Simple. Change the == to !=. You may have problems, however, if pid is used before you are finished debugging. In typical cases, however, it will not be used except in the parent, after the child is done. This will allow you to debug the code up to an exec. If you want to debug code after an exec, someone else has already posted a solution for that. If you are using dbx, it is safer to put a breakpoint inside the block, where your comment is in the above case, and continue. If you "step" or "next", both processes will have breakpoints in them, and the one you are not debugging may fail. If not dbx, this advice may still be relevant, I don't know. Glen