tags:

views:

43

answers:

2

Hello,

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.

Please Help Thank You

+2  A: 

That's because by default your distribution limits core file size to 0 blocks. The ulimit command you mentioned increases that limit to infinity.

I don't know about Ubuntu, but most distros have a file /etc/limits with system defaults for resource limits.

ninjalj
+1  A: 

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

Michalis Giannakidis