开发者

Core dump file not generated on segmentation fault

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 th开发者_Python百科e ulimit command everytime to generate a core file on the next run of my program ?.

The operating system i use is Ubuntu 10.10.


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


You might also want to try to edit /etc/security/limits.conf file instead of adding ulimit -c unlimited to ~/.bashrc.

The limits.conf is the "correct" place where to specify core dump details in most Linux distros.


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.


The segmentation fault is due to irrelevant values for path variables. On my system the user is sidd@sidd-Lenovo-G460 and the contents added are as below.

PATH=$PATH:/home/sidd/ns-allinone-2.35/bin:/home/sidd/ns-allinone-2.35/tcl8.5.10/unix:/home/sidd/ns-allinone-2.35/tk8.5.10/unix

LD_LIBRARY_PATH=/home/sidd/ns-allinone-2.35/otcl-1.14:/home/sidd/ns-allinone-2.35/lib

TCL_LIBRARY=/home/sidd/ns-allinone-2.35/tcl8.5.10/library

Please refer this blog post (VERY IMPORTANT).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜