Debugging Core Files Using HP WDB (5900-1573; WDB 6.2; January 2011)
1. Invoke WDB on the core file, as follows:
$gdb example core
HP gdb Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest )Wildebeest is free software, covered
by the GNU General Public License, and you are welcome to change it
and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions. There is
absolutely no warranty for Wildebeest.
Type "show warranty" for details.
..(no debugging symbols found)...
Core was generated by `example'.
Program terminated with signal 6, Aborted.
warning: The shared libraries were not privately mapped; setting a
breakpoint in a shared library will not work until you rerun the program.
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...#0 0xc01082b8 in kill () from /usr/lib/libc.2
2. View the backtrace information to analyze the flow of routines in the program that
resulted in a program abort. The following backtrace information of the core file
illustrates that function_abort() invoked the abort library call in libc to kill
the process:
(gdb) bt
#0 0xc01082b8 in kill () from /usr/lib/libc.2
#1 0xc00a52e8 in raise () from /usr/lib/libc.2
#2 0xc00e5c8c in abort_C () from /usr/lib/libc.2
#3 0xc00e5ce4 in abort () from /usr/lib/libc.2
#4 0x2420 in function_abort () from /home/u492893/example/./example
#5 0x23d0 in function_b () from /home/u492893/example/./example
#6 0x23a0 in function_a () from /home/u492893/example/./example
#7 0x2370 in main () from /home/u492893/example/./example
This program is not compiled with the debug option. However, if parts of the program
are compiled using the debug option, you can view information about the source
file that contains this code, the line number of the code where the program crashed,
and all the function parameters. You can also list the source code for the parts of
the program that are compiled using the debug option.
3. Traverse the stack to view the call chain.
Following are some of the basic commands for traversing the stack:
• To traverse (up or down) the call chain, enter the up or down command as in
the following example:
(gdb) up
#1 0xc00a52e8 in raise () from /usr/lib/libc.2
To execute the previous command at gdb prompt, press Enter at the gdb prompt,
as in the following example:
(gdb)
#2 0xc00e5c8c in abort_C () from /usr/lib/libc.2
(gdb)
#3 0xc00e5ce4 in abort () from /usr/lib/libc.2
Examples Illustrating Core File Debugging 41