Debugging Core Files Using HP WDB
From previous disassembling we know that the pointer to the struct st_one was stored at
-0x64 (-100) on from $sp in the function_abort routine. However, the pointer to the
structure is stored on the stack.
Taking the offset from the stack pointer into account, we must deference the pointer twice to get
from the stack pointer to the structure, and subsequently dereference this structure to print all
the members of this structure.
(gdb) p *(struct st_two *)(0x7f7e66ac)
$2 = {a = 0x40001130 "of life", b = 99, c = 19.2099991, d = 0x40001138 "is 42"}
(gdb) p *(struct st_two *)($1.three)
$3 = {a = 0x40001130 "of life", b = 99, c = 19.2099991, d = 0x40001138 "is 42"}
(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 0x2428 in sigismember () from /home/u492893/example/temp/./example
#5 0x23d8 in main () at example2.c:18
#6 0x23a8 in lwp_setprivate () from /home/u492893/example/temp/./example
#7 0xc00a52e8 in raise () from /usr/lib/libc.2
#8 0x40001140 in __d_trap_fptr ()
#9 0xc00a52e8 in raise () from /usr/lib/libc.2
Cannot access memory at address 0xffffffad.
(gdb) symbol example
Load new symbol table from "example"? (y or n) y
Reading symbols from example...
(no debugging symbols found)...done.
(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 0x2428 in function_abort () from /home/u492893/example/temp/./example
#5 0x23d8 in function_b () from /home/u492893/example/temp/./example
#6 0x23a8 in function_a () from /home/u492893/example/temp/./example
#7 0x2378 in main () from /home/u492893/example/temp/./example
46