If it is the child process you are interested in
testing, some way of attaching to the child after the fork has occurred is required.
NOTE The act of attaching a debugger to a process refers to using a
debugger to latch onto a process that is already running. This is different from
the common operation of launching a process under debugger control. When
a debugger attaches to a process, the process is paused and will not resume
execution until a user instructs the debugger to do so.
When using a GUI-based debugger, attaching to a process is usually accomplished via
a menu option (such as File | Attach) that presents a list of currently executing processes.
Console-based debuggers, on the other hand, usually offer an attach command that
requires a process ID obtained from a process listing command such as ps.
In the case of network servers, it is common to fork immediately after accepting a new
client connection in order to allow a child process to handle the new connection while
the parent continues to accept additional connection requests. By delaying any data
transmission to the newly forked child, you can take the time to learn the process ID of
the new child and attach to it with a debugger. Once you have attached to the child, you
can allow the client to continue its normal operation (usually fault injection in this
case), and the debugger will catch any problems that occur in the child process rather
than the parent.
Pages:
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611