Debugging with GDB (February 2008)

Table Of Contents
164 Debugging with GDB
or
set MPI_FLAGS= ewdb for invoking WDB
For more information, see the mpidebug(1) and mpienv(1) manpages.
Attaching the debugger to an MPI process (or to any other process that has not been
compiled for debugging) can result in the following warning:
warning: reading ’r3’ register: No data
14.13 Debugging multiple processes ( programs with fork
and vfork calls)
14.13.1 Ask mode for set follow-fork-mode
The ask command prompts the user to select between parent and child as the debugger
response to a program call of fork/vfork. Based on the user selection, the parent or
the child process is debugged.
For example:
(gdb) set follow-fork-mode ask (gdb) show follow-fork-mode
The debugger response to a program call to fork or vfork is ask.
(gdb) run Starting program: sample [New process 4941] Select follow-fork-
mode: [0] parent [1] child
14.13.2 serial mode for set follow-fork-mode
The option serial, for the follow-fork-mode command, enables debugging of a parent
and child process within a debugger session. During a debug session, if the parent
process forks a child, the debugger starts debugging the child process. When the child
process exits, the debugger switches back to the parent process. The follow-fork-
mode will work only if there is a wait() call by the parent process. This feature is
enabled by setting the follow-fork-mode flag to serial, as specified in the following
example:
(gdb) set follow-fork-mode serial
The follow-fork-mode is not supported under following conditions:
MxN threaded programs
Parent process is 32-bit and child process is 64-bit and vice versa. For the follow-
fork-mode to work both parent and child process must be of the same mode.
14.13.3 Support for showing unwind info
The maint info unwind command prints the unwind information for the regions un-
winded at the given address expression. Usage:
maint info unwind exp