Application programs involving multiple processes are those that call the fork() and exec() functions. When a program forks, the operating system creates another process that has the same image as the original; the original is called the parent process, and the created process is called the child process.
When a process calls an exec() function, a new program takes over or overlays the original program. Under default circumstances, the dbx utility can debug only the original or parent program; however, dbx can follow the execution and debug the program.
You must enter the multproc on subcommand to enable dbx to debug application programs that call an exec() function or to debug child processes created through use of the fork() function.
(dbx) multproc on
(dbx) multproc
multi-process debugging is enabled
(dbx) run
application forked, child pid=65544, process stopped, awaiting input
use 'dbx -A 65544' on another terminal to establish a debug session
for the child pid
stopped due to fork with multiprocessing enabled in fork at 0x2a89074
0x2a89074 bfffd084 icm $r15,X'F',X'84'($sp)
(dbx)
dbx -A 65544
Waiting to attach process 65544 …
attached in fork at 0x2a89074
0x2a89074 bfffd084 icm $r15,X'F',X'84'($sp)
(dbx)
At this point there are two distinct debugging sessions. The debugging session for the child process retains all the breakpoints from the parent process, but only the parent process can be rerun.
(dbx31) multproc
Multi-process debugging is enabled
(dbx31) run
FDBX6421: Loaded debug data from "./execprog.dbg"
FDBX0150: Debug target is 31-bit
FDBX0279: Attaching to process from exec…
FDBX6421: Loaded debug data from "./samp.dbg"
(dbx31)
Enter the map subcommand to determine the name of the new program being debugged.
When you are finished debugging the new program and end the dbx debugging session, enter the exit shell command to end the shell session and return to your first shell session.