Using GDB to debug a program that uses fork(2)?

Using GDB to debug a program that uses fork(2)?

Post by Tim Wy » Sat, 13 Feb 1993 06:08:34



This is driving me *nuts*.  I'm trying to use GDB to debug a
daemon which has a fork(2) call in it.  How do I tell
GDB to continue debugging the child after the parent process
dies?  I've looked in the manual, and didn't see anthing which
addresses this directly.

I tried to use "attach" on the running daemon, but when I
did, I got an error message saying "Can't attach to process
on this machine."

I'm working on a Silicon Graphics Indigo Elan, running
IRIX 4.0.5.  The GDB version is 4.7, compiled with
gcc-2.3.3.

What am I doing wrong?  Any ideas?

Thanks,

Tim

 
 
 

1. Need help debugging C program using gdb

are you sure you always keep the width/height of the arrays
straight?  i ask because of this line of code:

    printf("Image size: Height %d Width %d\n",width,height);

and in the malloc_* routines, you refer to the dimensions as "x" and "y",
but in the write_image rourines you refer to them as "width" and
"height".  this probably makes it easy to confuse the two.

also, i noticed these things about your code:

+ don't cast the return values from malloc.  it can only hide errors.
just make sure to include <stdlib.h>.

+ don't cast the argument to free(), either.

to help yourself with the debugging, make a separate version of your
program that's as small as possible.  discard all the stuff that isn't
used for the case that produces the bug.  then see if the bug still
happens.

---
"... What with you being his parents and all, I think that you could
be trusted not to shaft him."  -- Robert Chang, rec.games.board


2. Protect your PC from investigations (8aq g5)

3. Debugging curses program using Emacs gdb-mode

4. Crack 5

5. How to debug using workshop when my program uses Xerces parser

6. gcc Installation (NewBie)

7. On-Line Kernel Debugging Using Remote GDB

8. compiling problem

9. Remote debugging using gdb server

10. How can i debug a shared library using gdb..

11. debugging shared libraries using gdb

12. debugging using GDB and JTAG on MIPS 4kc

13. debugging a shared library using gdb on linux