How to diagnose a problem using a core dump

core-dump

I have the following core dump:

pth_signal.pthread_kill(??, ??) at 0xd0124734
pth_signal._p_raise(??) at 0xd01241a4
raise.raise(??) at 0xd038acd0
abort.abort() at 0xd03eeb78
_ZN10__cxxabiv111__terminateEPFvvE(handler = ??), line 47 in "eh_terminate.cc"
_ZSt9terminatev(), line 57 in "eh_terminate.cc"
__cxa_throw(obj = ??, tinfo = ??, dest = ??), line 77 in "eh_throw.cc"
unnamed block in _Znwm(sz = 4048060128), line 54 in "new_op.cc"
unnamed block in _Znwm(sz = 4048060128), line 54 in "new_op.cc"
unnamed block in _Znwm(sz = 4048060128), line 54 in "new_op.cc"
_Znwm(sz = 4048060128), line 54 in "new_op.cc"
_Znam(sz = ??), line 36 in "new_opv.cc"
_ZN7PROFILEC1ERK6STRING(this = @0x2fe74398, iniFilename = @0x21973300), line 99 in "profile.cpp"
_ZN2IE17AppendToBDataListEP10BASKETDATA(this = @0x2130eb38, bd = 0x2fe7f000), line 2451 in "ie.cpp"
_ZN5DIEGO14HandleResponseEP10BASKETDATAPv(this = 0x2130eb38, bd = 0x2fe7f000, args = 0x2fe71d78), line 513 in "diegoclass.cpp"
_ZThn68_N5DIEGO14HandleResponseEP10BASKETDATAPv(0x2130eb7c, 0x2fe7f000, 0x2fe71d78), line 21 in "diegoclass.h"
_ZN8KOBJBASE8dispatchEiP10BASKETDATAPv(this = 0x2130eb7c, fcnidx = 12, bd = 0x2fe7f000, args = 0x2fe71d78), line 67 in "kobjbase.cpp"
_ZN6KERNEL8DispatchEPcS0_iP10BASKETDATAPvR4LISTI8KOBJBASEE(this = @0x2fe71d38, module = "diego", method = "HandleResponse", fcn_idx = 12, bd = 0x2fe7f000, args = 0x2fe71d78, thread_objects = @0xf156dd58), line 1118 in "skernel.cpp"
unnamed block in _ZN6KERNEL9ExecuteTXEP10BASKETDATA(this = @0x2fe71d38, bd = 0x2fe7f000), line 224 in "txthread.cpp"
unnamed block in _ZN6KERNEL9ExecuteTXEP10BASKETDATA(this = @0x2fe71d38, bd = 0x2fe7f000), line 224 in "txthread.cpp"
_ZN6KERNEL9ExecuteTXEP10BASKETDATA(this = @0x2fe71d38, bd = 0x2fe7f000), line 224 in "txthread.cpp"
unnamed block in _ZN6KERNEL22ProcessEnqueuedBasketsEP6BASKET(this = @0x2fe71d38, b = @0x2fe7ef68), line 1162 in "skernel.cpp"

How can I use the core dump to fix the crash I'm having?

Best Answer

First, you run that output through c++filt, which demangles the C++ symbols into human-readable, and source-code cross-reference-able output.

From that you see that the PROFILE constructor has called new[] which has caused an exception to be raised for which there is no handler (std::terminate is called), which causes the program to abort, generating a core dump.

You can wrap the call to new[] in a try...catch block to see what the exception is. I cannot remember off the top of my head what exceptions new[] can raise and under what circumstances, but one cause of new failures is a corrupt heap, commonly from either overwriting the bounds of an allocation or a double delete.

You can diagnose these memory errors using programs like valgrind (free) or purify (commercial, assuming it still exists - I last used it 15 years ago). valgrind would be a good start and it will show you your memory errors of the form mentioned above.

You can go deeper with the core dump using gdb to inspect the memory image of your program at the time it crashed, but no-one here can really help with that - you need to know the structure of your code and the expected memory layout to do much with this.

Related Question