Coredump enable and corefile pattern configuration on Linux.

2012-03-02  李琪 

[root@ip170rhel6u2 ~]# cat /etc/profile |grep unlimited
ulimit -S -c unlimited > /dev/null 2>&1
[root@ip170rhel6u2 ~]# . /etc/profile
[root@ip170rhel6u2 ~]# ulimit -c
unlimited
[root@ip170rhel6u2 ~]#

[root@ip170rhel6u2 ~]# cat /etc/sysctl.conf |grep kernel.core_pattern
kernel.core_pattern = /tmp/corefile/core.%s.%e.%t
[root@ip170rhel6u2 ~]#

[root@ip170rhel6u2 qli]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.sem = 250 400000 32 2000
net.ipv4.conf.all.promote_secondaries = 1
net.ipv4.ip_forward = 1
kernel.core_pattern = /tmp/corefile/core.%s.%e.%t
[root@ip170rhel6u2 qli]#

[root@ip170rhel6u2 qli]# mkdir -p /tmp/corefile
[root@ip170rhel6u2 qli]# ls
test  test.c
[root@ip170rhel6u2 qli]# ls /tmp/corefile/
[root@ip170rhel6u2 qli]# ./test
Segmentation fault (core dumped)
[root@ip170rhel6u2 qli]# ls /tmp/corefile/
core.11.test.1330595654.29375
[root@ip170rhel6u2 qli]# gdb ./test /tmp/corefile/core.11.test.1330595654.29375

383°/3832 人阅读/0 条评论 发表评论

登录 后发表评论