Can we get memory map from core dumps? If we can get something
pmap's output, it would be great.
Literally speaking, that information is not preserved in core dumps.
If you are handling a live process, there is /proc/PID/maps (which
is what pmap reads).
For the set of ELF objects and their addresses, you can extract this
indirectly from a core file. (This is what gdb et al do.)
The concise example of this is: eu-unstrip -n --core=COREFILE
Quit (core dumped)
$ eu-unstrip -n --core=core.17211
0x400000+0x20e000 0948352b72da50b6935f3530d05835b7c2257db2@0x40024c - - [exe]
0x7fff57dff000+0x1000 c95ede4b7d34f7c09d2da64b229cce581b17c9f4@0x7fff57dff2f8 . -
/lib64/libc-2.9.so /usr/lib/debug/lib64/libc-2.9.so.debug libc.so.6
/lib64/ld-2.9.so /usr/lib/debug/lib64/ld-2.9.so.debug ld-linux-x86-64.so.2
This command-line tool does more work eagerly than you need (finding
the debuginfo et al). But it demonstrates the libdwfl core file
support that you can use in your own programs.
With partial-segments core dumps (default in Fedora >= 8), this
works directly. With old-style core dumps (still default in
upstream kernels without CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y),
you need to know the right exe file to be able to find the list of
DSO file names, and you won't have their build IDs. Life is simpler
if you are not worrying about that possibility.