Core dump file not generated on segmentation fault

Tim picture Tim · Oct 16, 2010 · Viewed 24.3k times · Source

I am trying to debug a segmentation fault caused by my C program using gdb. A core dump file is not automatically generated when I run my program,and i have to run the command

ulimit -c unlimited

for a core file to be generated on the next run.

Why is a core dump file not generated automatically and why do I have to run the ulimit command everytime to generate a core file on the next run of my program ?.

The operating system i use is Ubuntu 10.10.

Answer

Michalis Giannakidis picture Michalis Giannakidis · Oct 16, 2010

You need to place the command

ulimit -c unlimited

in your environment settings.

If you are using bash as your shell, you need to place the above command in ~/.bashrc