Where’s my Core Dump?

coreIn the old days, the most dreaded message on a Unix system was segmentation fault: core dumped. In the case where it was your program that dumped, you then had to fire up adb and pour over the registers and the stack, cross referencing with the assembly language produced by your compiler. Things got a lot better with symbolic debuggers like gdb, then even better with graphical front ends like ddd. But one thing remained constant: the need for the core file, the snap shot of the process at the moment it died.

Unfortunately, as computers got more powerful, cores got bigger. Dumping them can take significant time, and they typically drop in the directory containing the program that dumped, eating up disk space and needing to be cleaned up. In recent years, this has led to Linux distributions disabling core dumps by default. That’s great until you actually need to debug a program. Then you need to turn them on by running:

ulimit -c unlimited

This can be done in a terminal window for a single session, in ~/.bashrc to make it the default for you, or, if you have sudo privileges, in /etc/profile to make it the default for all users.

Here’s an article with some more details: How To Enable Core Dumps

Advertisements

About jimbelton

I'm a software developer, and a writer of both fiction and non-fiction, and I blog about movies, books, and philosophy. My interest in religious philosophy and the search for the truth inspires much of my writing.
This entry was posted in programming and tagged , , , , , , . Bookmark the permalink.

One Response to Where’s my Core Dump?

  1. Pingback: Debugging a Core with DDD – Programming with Jim

Leave a Comment

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

WordPress.com Logo

You are commenting using your WordPress.com 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