ptrace(S) allows processes to be traced by processes other than their parent. dbXtra/dbxtra uses this feature to allow you to debug the child process when a process forks. On prior releases of the debuggers, when a debugged process forked, the child ran to completion. You can now control what happens by setting the $fork variable. This command must be typed into the interaction window in on of the following ways:
The following comments apply to the set $fork="both" option.
The debugger stops the child right after the fork, before it has executed any code. Be sure to set breakpoints in the child before you allow it to continue. If you rerun the child, the original child process exits with SIGTRAP as the terminating signal. This is the result the parent process will get from wait(S). If the parent is in wait, the wait will return as soon as you say rerun. This is rarely what you want to do.
The parent continues running normally after the fork, although it is under the control of the debugger. If you want it to stop, be sure to set a breakpoint in the code the parent will run so that it stops.
It can be confusing to debug two processes at the same time. Using the set $fork="push" is simpler if it will do the job for you.
When the child exits, you are notified in the debugger message window. You must exit the child dbXtra before the child process actually terminates. If the parent is going to wait(S) for the child, the wait(S) will not complete until this happens.
If the child process has not executed an exec(S) system call, quitting the debugger (either from the menu, or a quit command) will cause the dbx controlling the parent process to exit as well. This causes the entire debugging session to terminate, and the parent dbXtra to issue an error message.
The workaround is to go to another window, and kill(C) (SIGTERM works) the child screen manager process, that is, the instance of dbXtra that is associated with the child process. This instance of dbXtra will have a dbx as its parent process.
This will cause the child and its debugger to terminate, and things will operate normally from there.
If the child has executed an exec(S), it seems that you can quit the child debugger normally.