Debugging Core Files Using HP WDB (5900-1573; WDB 6.2; January 2011)
(gdb)
#4 0x2420 in function_abort () from /home/u492893/example/./example
• You can also directly traverse the stack by entering the number of frames as an
option in the up or down command, as follows:
(gdb) up 4
#4 0x2420 in function_abort () from /home/u492893/example/./example
(gdb) down 4
#0 0xc01082b8 in kill () from /usr/lib/libc.2
• To traverse the stack by using the frame number, enter the frame command,
as in the following example:
(gdb) frame 4
#4 0x2420 in function_abort () from /home/u492893/example/./example
4. Disassemble the required calling function.
To view information about the function prototype and the definition of the structures
in the prototype, you must disassemble the required function. This displays the
location of the stored function parameters if the function has stored the parameters.
The following example illustrates the disassembly of function_abort:
(gdb) disassemble function_abort
Dump of assembler code for function function_abort:
0x23f4 <function_abort>: stw %rp,-0x14(%sr0,%sp)
0x23f8 <function_abort+4>: ldo 0x40(%sp),%sp
0x23fc <function_abort+8>: stw %r26,-0x64(%sr0,%sp)
0x2400 <function_abort+12>: stw %r25,-0x68(%sr0,%sp)
0x2404 <function_abort+16>: ldw -0x64(%sr0,%sp),%r20
0x2408 <function_abort+20>: ldw 8(%sr0,%r20),%r21
0x240c <function_abort+24>: ldi 0x63,%r22
0x2410 <function_abort+28>: stw %r22,4(%sr0,%r21)
0x2414 <function_abort+32>: ldil L'0x2000,%r31
0x2418 <function_abort+36>: be,l 0x3dc(%sr4,%r31)
0x241c <function_abort+40>: copy %r31,%rp
0x2420 <function_abort+44>: ldw -0x54(%sr0,%sp),%rp
0x2424 <function_abort+48>: bv %r0(%rp)
0x2428 <function_abort+52>: ldo -0x40(%sp),%sp
End of assembler dump.
If the parameters are not stored on the stack, the task of reading the core file is
similar to reading a kernel crash dump. In such cases, you must analyze the routines
that are invoked before the required function and check if the parameters are passed
up the stack by these routines. You must also check if these routines have saved the
address or the value on the stack.
5. Analyze the assembler dump from the disassembly output.
The first four arguments for a function are passed through registers for PA-RISC
32–bit binaries. However, the stack is not updated using these values. The invoked
function saves the arguments to the stack, if required. If the function parameters are
42