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

To display the float value at $xtra+0x8, enter the following command
at the gdb prompt:
(gdb) x/f $xtra+0x8
0x7f7e66a4: 19.2099991
To display the string value pointed to by $xtra+0xC , enter the following
command at the gdb prompt:
(gdb) x/s *($xtra+0xC)
0x40001138 <__d_trap_fptr+284>: "is 42"
Example 9 Debugging a Core File to View Information on a Global Variable in a C
program
In this example, the address, &global_vars, of global_vars is required for
debugging. If the required structure is a pointer, the address of the structure is not required.
The address of the structure is cast to (char*) so that any increments to this address will
be 1 byte.
The program in this example uses the global structure, global_vars.
Following is the global structure, global_vars:
struct gvals {
char *program; +0x0
int arg_count; +0x4
char *first_arg; +0x8
char *path; +0xC
int secret; +0x10
};
struct gvals global_vars;
Sample Debugging Session
1. To store the address of global_vars in the convenience variable, $glob, enter
the following command at the gdb prompt:
(gdb) set $glob= (char*)&global_vars
2. To display the string value pointed to by $glob+0x0, enter the following
command at the gdb prompt:
(gdb) x /s *($glob+0x4)
0x7f7e6000: "./example1"
3. To display the int value at $glob+0x4, enter the following command at the gdb
prompt:
(gdb) x/x $glob+0x1
0x40001184 <global_vars+4>: 0x00000001
4. To display the string value pointed to by $glob+0x8, enter the following
command at the gdb prompt:
48