[Linux]Enable core dump in linux

http://stackoverflow.com/questions/2919378/how-to-enable-core-dump-in-my-linux-c-program

http://www.akadia.com/services/ora_enable_core.html

0. Make sure the programe is compiled in debug mode( -g) with gcc. 

1. check ulimit -a

lifsong@lifen ~ $ ulimit -a
core file size (blocks, -c) 0 // here its zero
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31392
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31392
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited


2. set it to unlimited.

lifsong@lifen ~ $ ulimit -c unlimited


3. Note: some .bashrc or .profile may always set it to zero, check these files.
global setting is normally in /etc/security/limits.conf

4. If you're using some scripts to start your app, add ulimit -c "size" to enable the core dump setting before starting the app.

posted on 2012-06-26 08:40  Lifen, Song  阅读(472)  评论(0编辑  收藏  举报

导航