Technical Blog Post
Abstract
HOW TO LOAD A CORE FILE ON SOLARIS
Body
A core file is the image of a process' memory but does not contain some of the information a debugger needs to work properly. Some of those information are for example the 'symbol table' and the 'instructions'.
Both executable and loaded objects (dynamic libraries) have each their own set of instructions and symbols. The libraries, especially system ones, used by the process on the machine where the core file comes from might be different from the ones used on the machine where the core file is to be analyzed. As well the path of those libraries might be different on both machines.
For the debugger to work properly the core file, the executable but also all the loaded objects from the original machine should be copied to the machine where the core file is to be examined. Then some extra steps are required to let the debugger know where to find those original libraries and objects.
On SOLARIS the debugger commonly used is 'dbx'. For 'dbx' to be able to locate the original objects you need to first set 'core_lo_pathmap' to let the debugger know that it has to look at your settings first rather than using the information provided by the core file headers. Second you have to set the libraries and object mappings to let the debugger know where to find each 'path' from the original machine on the local machine using 'pathmap' command. Also since after the copy from original to local machine can change dates you have to force 'dbx' to load the core file even if it shows as older that the executable and that can be done with the '-f' option on the 'debug' command.
Example:
[/home/dalla/analysis] ls -l
drwxr-xr-x 3 dalla pdxdb2 512 Nov 22 15:58 lib
-rw-r--r-- 1 dalla pdxdb2 18071156055 Nov 17 2016 mycore
drwxr-xr-x 3 dalla pdxdb2 512 Nov 22 15:58 platform
drwxr-xr-x 3 dalla pdxdb2 512 Nov 22 15:58 usr
[/home/dalla/analysis] dbx
For information about new features see `help changes'
(dbx) dbxenv core_lo_pathmap on
(dbx) pathmap /lib /home/dalla/analysis/lib
(dbx) pathmap /platform /home/dalla/analysis/platform
(dbx) pathmap /usr /home/dalla/analysis/usr
(dbx) pathmap /db2home/db2mnrp1/sqllib /home/dalla/sqllib
(dbx) pathmap /opt/IBM/db2/V10.1/lib64 /home/dalla/sqllib/lib64
(dbx) debug -f /home/dalla/sqllib/adm/db2sysc mycore
core file header read successfully
Reading ld.so.1
Reading libdb2e.so.1
Reading libdb2osse.so.1
Reading libm.so.2
Reading libsocket.so.1
...
UID
ibm13286449