Debugging application core dump

Quite often, developers need to analyze core dumps generated in customer production system’s to fix the issue. It could so happen that the version of application/patches installed in developer’s machine are different than the one customer has. When the core file is loaded in GDB, errors similar to
/usr/lib/hpux64/ in the core file is different from
/usr/lib/hpux64/ used by gdb

could be displayed by GDB. Starting to analyze the core file with these set of different libraries will not provide the required results. GDB will not provide useful data even if one of the libraries is mismatching.

So developer is left with two choices
a. setup a system similar to customer environment (os+patches and application+patches ) or
b. get the all libraries which are used by binary which core dumped from customer setup.

Option “a” is tedious task and as such option “b” is definitely much easier and less time consuming.

Consider option “b”. How to can we get all the libraries used by application binary which resulted in crash? Use the following set of command to collect all information from customer setup

1. execute “file ” command to get the binary which core dumped.
2. use the ldd command to get all the library information which the binary uses.
eg. If a.out is the binary name
# ldd a.out

a.out: => /usr/lib/hpux32/ => /usr/lib/hpux32/
Collect all the libraries listed from customer system and copy them to specific location in development machine say /tmp/lib/

Set the following environment variable

Start analyzing the core file

Errors which were displayed earlier will not be displayed now.

Libraries displayed need not be only system libraries, they can be application specific libraries too.

This entry was posted in C Section. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s