Debugging Core Files Using HP WDB

Method 2:
In this method, you can use the gdb convenience variables to store and manipulate
memory addresses. You can use the show conv command to view the current values
of the convenience variables. The nomenclature of all convenience variables is such that
they start with the $ symbol. The following debugging session illustrates this method:
— To set $my_arg0 as the value pointed by $sp-0x64, enter the following command
at the gdb prompt:
(gdb) set $my_arg0=*($sp-0x64)
To examine the contents of $my_arg0, enter the following command at the gdb
prompt:
(gdb) x/x $my_arg0
0x7f7e6688: 0x00000011
— To display the string value at $my_arg0+4, enter the following command at the
gdb prompt:
(gdb) x/s *($my_arg0+4)
0x40001140 <__d_trap_fptr+292>: "NOT!"
— To store the value pointed by $my_arg0+0x8 in $xtra , enter the following
command at the gdb prompt:
(gdb) set $xtra=*($my_arg0+0x8)
— To display the int value pointed to by $my_arg0+0xc , enter the following
command at the gdb prompt:
(gdb) x/x *($my_arg0+0xc)
0x7f7e6688: 0x00000011
— To display the string value pointed to by $my_arg0+0x10, enter the following
command at the gdb prompt:
(gdb) x/s *($my_arg0+0x10)
0x40001120 <__d_trap_fptr+260>: "The meaning"
— To display the string value pointed to by $xtra, enter the following command
at the gdb prompt:
(gdb) x/s *($xtra)
0x40001130 <__d_trap_fptr+276>: "of life"
— To display the int value at $xtra+0x4, enter the following command at the gdb
prompt:
(gdb) x/x $xtra+0x4
0x7f7e66a0: 0x00000063
— 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"
38