Debugging question

what is considered best practice for debugging fork()ed off processes
with gdb? The answer may be fairly obvious to those of you working
with it every other day. But I didn't come across a solution except for

- - insert a loop at the beginning of the child-code
- - when loop is reached, look up PID
- - attach new process
- - release loop flag

I suspect there might be sth. more sophisticated to get along with a
thing like code containing fork()s, which isn't exactly rare. I know
about the follow-fork-mode, but it doesn't seem to work.