Debugging Core Files Using HP WDB (5900-1573; WDB 6.2; January 2011)
(gdb) p t
$9 = 0x60000000c1a91000 <Address 0x60000000c1a91000 out of bounds>
(gdb) mmapfile testfile 0x60000000c1a91000 0 0xe1
(gdb) p t
$10 = 0x60000000c1a91000 "#include <stdlib.h>\n#include <stdio.h>\nint main(){\n foo();\n
bar();\n return 0;\n}\nint foo(){\n int * res = malloc(4);\n printf(\"*res %d\\n\", *res);\n
return 1;\n}\nint bar(){\n printf(\"Hel"...
(gdb) p (t+0xd0)
$11 = 0x60000000c1a910d0 " return 2;\n}\n\n" <Address 0x60000000c1a910e1 out of bounds>
(gdb) p u
$12 = 0x60000000c4406000 <Address 0x60000000c4406000 out of bounds>
(gdb) mmapfile testfile2 0x60000000c4406000 0 0x100
(gdb) p u
$13 = 0x60000000c4406000 "\nSymtab for file
../../../../Src/gnu/gdb/testsuite/gdb.base/shlib31.c\nCompilation directory is
/view/kerch.vs.gdb/CLO/Components/WDB/build/ia64-hp-hpux-native/gdb/testsuite\nRead from object file
/view"...
(gdb) i target
...
0x200000007aada000 - 0x200000007aada0e1 is segment24 (Added with mmapfile ‘testfile’) ---Type
<return> to continue, or q <return> to quit---
0x60000000c1a91000 - 0x60000000c1a910e1 is segment25 (Added with mmapfile ‘testfile’)
0x60000000c4406000 - 0x60000000c4406100 is segment26 (Added with mmapfile ‘testfile2’) ...
This command gives an error if the address overlaps already existing sections.
(gdb) mmapfile testfile 0x200000007aadc000 0 0x56
BFD: Error : The section (segment7) address overlaps with the
user given address range for mmapfile command. Use the
``info target'' command to display all the segments from the
core file.
mmapfile = testfile can not be added
Specifying an unknown file, or providing an incomplete or wrong command reports
appropriate error messages.
(gdb) mmapfile xyz 0x60000000c1a91000 0 0xe1
mmapfile = xyz can not be opened (errno = 2)
(gdb) mmapfile testfile 0x60000000c1a91000
Usage:
mmapfile <FILENAME> <MAP-ADDRESS> <FILE-OFFSET> <LENGTH>
Summary
WDB enables you to debug a core file and analyze the cause for the core dump. It also
enables you to force a core dump of an application and analyze the process state of
the application. In addition, you can debug a core file on a system that is different from
the system on which the core file was created.
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.
Summary 39