How to enable coredump on centos 7.6

Don't know why coredump is disabled by default on centos7.6 as below:

#cat /proc/sys/kernel/core_pattern
core

Enable as follows:

#echo 'kernel.core_pattern=|/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e' > /etc/sysctl.d/50-coredump.conf
#/lib/systemd/systemd-sysctl
#sysctl -a | grep 'kernel.core_pattern'
kernel.core_pattern = |/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e

How to generate coredump on purpose?

Press ctl + \:

#sleep 100
^\Quit (core dumped)

or use gdb attach a running task and run:

#sleep 100 &
[1] 5121

#gdb -p 5121

(gdb) generate-core-file
warning: target file /proc/5121/cmdline contained unexpected null characters
warning: Memory read failed for corefile section, 8192 bytes at 0x7ffd4d94f000.
Saved corefile core.5121
(gdb)

coredump:

#ls /var/lib/systemd/coredump/
core.sleep.0.f4b677edcb284566a56c5e61a621fca5.44660.1555487558000000.xz

转载于:https://my.oschina.net/u/2475751/blog/3032104

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值