Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable program to dump core on linux?

Tags:

c

linux

coredump

I want the program to dump core on crash on Linux for debugging purpose. How do I enable this feature - does this require any changes in the program ?

like image 772
Shraddha Avatar asked Oct 30 '25 18:10

Shraddha


2 Answers

You can either enable it for yourself by doing:

ulimit -c unlimited

If you want this to be persistent put it in ~/.profile

Alterantively, you can enable core dumps for all users on the system put the following line in /etc/sercurity/limits.conf (at least on ubuntu):

*   0  core    -1
like image 76
goji Avatar answered Nov 01 '25 09:11

goji


Whether generate core dump or not is controlled by the shell

If you use bash.

ulimit -c unlimited
like image 26
louxiu Avatar answered Nov 01 '25 09:11

louxiu