HP (Hewlett-Packard) 5992-4701 Computer Hardware User Manual


 
set follow-fork-mode mode
Set the debugger response to a program call of
fork or vfork. A call to fork or vfork creates
a new process. The mode can be:
parent
The original process is debugged after
a fork. The child process runs
unimpeded. This is the default.
child
The new process is debugged after a
fork. The parent process runs
unimpeded.
show follow-fork-mode Display the current debugger response to a fork
or vfork call.
If you ask to debug a child process and a vfork is followed by an exec, GDB executes
the new target up to the first breakpoint in the new target. If you have a breakpoint set
on main in your original program, the breakpoint will also be set on the child process's
main.
When a child process is spawned by vfork, you cannot debug the child or parent until
an exec call completes.
If you issue a run command to GDB after an exec call executes, the new target restarts.
To restart the parent process, use the file command with the parent executable name
as its argument.
You can use the catch command to make GDB stop whenever a fork, vfork, or
exec call is made. See “Setting catchpoints” (page 56).
50 Running Programs Under GDB