Debugging with GDB (September 2007)
Chapter 14: HP-UX Configuration-Sp e cific Information 161
14.13.1 Ask mode for set follow-fork-mode
The ask com mand prompts the user to select betwee n 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 sp ec ified 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 proces s 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
where exp is an address expression.
For example:
(gdb) maint info unwind $pc
modsched:
0x4000930 .. 0x4000a20, end_prologue@0x4000970
Info block version:0x0, flags:0x0, length:4 * 4 == 16
0x40172b20: (0c) R1prologue rlen=12
0x40172b21: (e8) P7preds_when t=11
0x40172b23: (b1) P3preds_gr gr=41
0x40172b25: (ea) P7lc_when t=7
0x40172b27: (b2) P3lc_gr gr=40