Novice Programmer: I need help debugging child process

Novice Programmer: I need help debugging child process

Post by Ron Mart » Wed, 29 Mar 1995 09:28:35



  I'm trying to debug a child process under Linux.  My problem is that
as soon as I step through the call to fork() and try to attach the
child process, the child has terminated and zombied.  A couple of
other people suggested putting a non-terminating loop as the first
statement in the child process.  I tried that and still no luck.  My
last thought was to increase NPROC and recompile the kernel.  With an
NPROC of 20 the child still terminates.
  I'm a novice Linux(UNIX) programmer and am looking for *any*
suggestions.  Successfule sections of code that I could look at would
be appreciated as well.
  I'm running Linux 1.1.59, compiling with gcc, and debugging with gdb
under emacs.

Thanks,
  Ron Martin

 
 
 

Novice Programmer: I need help debugging child process

Post by F. Flor » Thu, 30 Mar 1995 01:15:19


:   I'm trying to debug a child process under Linux.  My problem is that
: as soon as I step through the call to fork() and try to attach the
: child process, the child has terminated and zombied.  A couple of
: other people suggested putting a non-terminating loop as the first
: statement in the child process.  I tried that and still no luck.  My

Why not?
This is a correct way to do it, and i tried it out on a Sun and
on my linux box - it worked...
Please try it again this way:
At the point you want to debug the child process, you have to
code in infinite loop, just like:
int a = 1;
while ( a );
after you started your prog, attach this child process from
the "outside" with your de*. First you need the PID...
 $ ps
 4711 mychildproc
 $ gdb ... 4711

 I'm sorry, but at the moment i can't remember the correct call
 with the gdb (and i am sitting at an AIX-Term), but type
 man gdb
 and this will help.

Be sure, this works...
Best wishes, Friedemann

 
 
 

1. Help: debugging a child process

Hi,

Is there anyone out there knowing how to debug a child process?
i've tried several times to attach GDB to a child process, say y,
forked by the parent process, say x, of one program. i've also
consulted the GDB manual but anyway i couldn't find a way to do it.
i may miss something in doing so. Could anyone please point me to
the clear way. Your help, advice, and/or example would be greatly
appreciated to the one who is now hopeless.

banchong


/      \ Fax:    +61-2-313-7987                      
\_.--._* Office: Computer Science, University of New South Wales,
      v          PO Box 1, Kensington, Australia, 2033          

2. Compile Problems with AMD K6-2/550 3D system

3. Help debugging child process w/gdb

4. pppd rewriting /etc/resolv.conf too..

5. Help: Child process dies while trying to debug

6. gethostbyname h_addr_list

7. smail failed to reap child process: No child processes

8. scsi external disk problem

9. Getting a child and child's child process-id

10. how to kill a child process that runs other children processes

11. Getting a child and child's child process-id

12. Debugging Child Processes

13. how can i debug child process