Can anything useful be done with a truncated core

core-dumpdebugginggdbrhel

We have processes written in a mix of Python, Java and C++ that core dump from time to time. They allocate more memory in chunks as needed during runtime, and are known to crash when their allocation tips over 4G (I guess the return value of the malloc() isn't checked).

However the core dumps produced are truncated, according to GDB – they are unlimited in size in the OS, and on-disk they vary between 2-3.8G in size.

GDB observes that the size doesn't match what it expects (presumably including the failed alloc?) and gives up – but in 3.8G of data there surely must be something of interest? Possibly even the entire stack I need for a backtrace!

How can I persuade GDB to at least try, or is there an alternate tool that can extract something from a truncated core?

Best Answer

This blurb on the Sun Studio 12 website would seem to imply that they're basically useless.

excerpt - http://docs.oracle.com/cd/E19205-01/819-5257/blabs/index.html

If Your Core File Is Truncated

If you have problems loading a core file, check whether you have a truncated core file. If you have the maximum allowable size of core files set too low when the core file is created, then dbx cannot read the resulting truncated core file. In the C shell, you can set the maximum allowable core file size using the limit command (see the limit(1) man page). In the Bourne shell and Korn shell, use the ulimit command (see the limit(1) man page). You can change the limit on core file size in your shell start-up file, re-source the start-up file, and then rerun the program that produced the core file to produce a complete core file.

If the core file is incomplete, and the stack segment is missing, then stack trace information is not available. If the runtime linker information is missing, then the list of loadobjects is not available. In this case, you get an error message about librtld_db.so not being initialized. If the list of LWPs is missing, then no thread information, lwp information, or stack trace information is available.If you run the where command, you get an error saying the program was not “active.”

Related Question