Debugging Core Files Using HP WDB
Examples Illustrating Core File Debugging
The examples in this section are for core files that are created on an HP 9000 system (PA-RISC).
If the program is not compiled with -g, the line number information is not available in the case
of core files on PA-RISC systems.
On the contrary, the source line number information is available for core files created by
Itanium-based binaries, irrespective of whether the core file is compiled with the -g option, or
not.
The following examples illustrate how to use the common core file debugging commands in
WDB:
(The examples are based on core files created by PA-RISC 32–bit binaries)
Example 6 Debugging a Core File to Find the Values for Parameters of a Function When the
Program is not Compiled with -g
Sample Program
The sample program used in this example has multiple functions. The function_abort()
function in this program causes the application to abort. This example illustrates how to debug
this core file and find values for the parameters of function_abort().
Following is the code for the structures in function_abort():
extern int function_abort(struct st_one *, int);
struct st_two {
char *a;
int b;
float c;
char *d;
};
struct st_one {
int one;
char *two;
struct st_two *three;
int *four;
char *five;
};
.
.
.
Sample Debugging Session
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
32