Stack only core dumps

I'm working on a program in Linux with a group of people scattered around the country. When we have a crash, I like to send a core dump to the appropriate person so that they can understand the problem better. The problem is that our application uses several gigabytes worth of data and these core dumps are very large. Sending these core dumps is getting difficult.

From my experience, all I really need from a core dump is the stack. I'll look at the back trace in gdb, and maybe inspect some local variables. Is there a way to tell Linux only to dump the stack rather than all memory?

I've tried using "ulimit -c" to change the upper limit on the size of the core dump but there doesn't seem to be any guarantee that this will include the stack. In my case, these truncated core dumps don't produce a backtrace in gdb.

Another thought that I had is that there may be a utility out there that will extract the stack from the core dump and produce a second, smaller core dump. I've been searching for a while and I can't find anything. Does anyone have any suggestions?

Thanks!

Hi,
a fast script solution (but not necessarily fast to run) is to search for some key string where the stack starts or ends? If You can specify such a string, is it data from the the top of the file until some string occurs that You want, or data from that string until the end of file, or data between two known strings?

Best regards,
Lakris

Two ideas:

  • you strip the core just to get the stack. Might perhaps be done with gdb
  • you program your own stack dump, see Glibc backtrace()

Cheers,
Lo�c

Loic Domaigne,

If I could use gdb to strip the core file, that would be wonderful but I don't see anyway to do that.

Your idea about the backtrace() function might be the closest thing to what I am trying to do. Unfortunately that won't allow me to use GDB to inspect local variables.

I've seen the stack only dump functionality in QNX (dumper -m). I'm suprised such a feature isn't available for Linux.

I don't know if that could help:

Cheers,
Lo�c

1 Like