方法一:
输入以下命令即可,其中${USER}为自己电脑的用户名:
ulimit -c unlimited
echo "/home/${USER}/core.%p" > /proc/sys/kernel/core_pattern
方法二:
Disable apport :
sudo systemctl stop apport.service
sudo systemctl disable apport.service
修改/etc/security/limits.conf文件 "#* soft core 0" 修改成 "#* soft core unlimited"
sudo vi /etc/security/limits.conf
控制core文件保存位置和文件名格式:
sudo sysctl -w kernel.core_pattern=/home/so/corefile/%e_core_%p_%t
修改/etc/sysctl.conf配置文件,添加:
kernel.core_uses_pid = 1
kernel.core_pattern = /home/so/corefile/%e_core_%p_%t
然后执行
sudo sysctl -p
.bashrc 添加:
ulimit -c unlimited
echo '123' | sudo -S sysctl -p