Debugging Core Files Using HP WDB (5900-1573; WDB 6.2; January 2011)

Debugging a Core File Created by a Forced Core Dump
To debug a core file that is created by a forced core dump, complete the following steps:
1. To dump the core for a live process, enter the following command at the gdb prompt:
(gdb) dumpcore
For example:
(gdb) run
Starting program: sample
Breakpoint 3, main () at sample.c:1010 b= foo(a);
(gdb) dumpcore
Dumping core to the core file core.24091
(gdb)
2. To analyze the dumped core file, enter one of the following commands:
At gdb prompt:
(gdb) core [core.<pid>|<corefile-name>]
For example:
(gdb) file sample
Reading symbols from sample...done
(gdb) set live-core 1
(gdb) core core.24091
Core was generated by sample.
#0 main () at sample.c:1010 b = foo(a);
(gdb) backtrace
#0 main () at sample.c:10
(gdb)
(Or)
At shell prompt:
% gdb --lcore a.out [core.<pid>|<corefile-name>]
For example:
% ./gdb --lcore sample core.24091
HP gdb for PA-RISC (narrow), HP-UX 11.23. Copyright 1986 -
2001 Free Software Foundation, Inc. Hewlett-Packard Wildebeest
(based on GDB) is covered by the GNU General Public License.
Type "show copying" to see the conditions to change it and/or
distribute copies.
Type "showwarranty" for warranty/support....
Core was generated by sample.
#0 main() at sample.c:10
(gdb)
Debugging Core Files From a Different System
When debugging a core file, the debugger requires the exact versions of shared libraries
and the executable that are associated with the core file.
Debugging Core Files From a Different System 25