Debugging with GDB (September 2007)

Chapter 14: HP-UX Configuration-Specific Information 163
The unpackcore command has two optional arguments. The first defaults to
packcore.tar.Z and is the name of the packcore file to be unpacked. The second
argument is given if the core file is too large to fit in the packcore file. It is the
path to the core file to be used if the packcore directory does not contain a core file.
If used,this second argument causes a symbolic link to be created in the packcore
directory in place of the missing core file.
The getcore command can be used to examine a packcore directory which was pre-
viously created by unpackcore. It takes one optional argument, the name of the
packcore directory, which defaults to packcore.
14.14.2 Support for the dumpcore command
HP WDB provides the command, dumpcore to generate a core image file for a process
running under the debugger during execution.
The dumpcore command does not require any argument. It saves the core image for
the current process being debugged in the file named core.<pid>, where <pid> is the
process ID number.
To dump the core for a live pro ce ss , you must pass the following commands:
(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)
When starting from the HP WDB command line:
(gdb) file sample
Reading
symbols from sample...done
(gdb) set live-core 1
(gdb) core-file 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)
When starting from the shell prompt:
% gdb --lcore a.out core.<pid>
For example:
% ./gdb --lcore sample core.24091
HP gdb...
Type "show warranty" for warranty/support....
Core was generated by ’sample’.#0 main () at sample.c:10
(gdb)
14.14.2.1 Enhancements to the dumpcore command
HP WDB provides an option for the dumpcore command, to specify a <core-
filename>, to generate a core image file of a process running under the debugger in
the middle of execution and saves it in the file named <core-filename>.