Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
(gdb) p u
$7 = 0x60000000c4406000 <Address 0x60000000c4406000 out of bounds>
The pointers r, s, t are from mmap-ed regions which are missing in corefile.
(gdb) help mmapfile
Add contents of memory mapped files missing from core dump.
Usage:
mmapfile <FILENAME> <MAP-ADDRESS> <FILE-OFFSET> <LENGTH>
This can be used if the core file does not contain mmap-ed regions
from the live run. This can happen for files mmap-ed with
MAP_PRIVATE with RO permissions, or for files mmap-ed with
MAP_SHARED. With this command, the user can access data from
the mmap-ed files, which are missing from the core file. The
``info target'' command displays all the segments from the
core file.
Now, add the region supposed to be pointed by "r".
(gdb) p r
$4 = 0x200000007aada000 <Address 0x200000007aada000 out of bounds>
(gdb) mmapfile testfile 0x200000007aada000 0 0xe1
(gdb) p r
$8 = 0x200000007aada000 "#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) i target
...
0x200000007aada000 - 0x200000007aada0e1 is segment24 (Added with mmapfile) ...
Next, add regions pointed to by t and u.
(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.
202 HP-UX Configuration-Specific Information