linux 配置C++程序的dump文件



1 打開core 開關

vim /etc/security/limits.conf
去掉 soft core 0 一行前面的注釋 並將0改為 unlimited

2 修改core產生路徑和命名規則

vim /etc/sysctl.conf
最后增加一行
kernel.core_pattern = /data/core/core-%e-%p-%t

可以將core文件統一生成到/cdata/core目錄下,產生的文件名為core-命令名-pid-時間戳
以下是參數列表:
%p - insert pid into filename 添加pid
%u - insert current uid into filename 添加當前uid
%g - insert current gid into filename 添加當前gid
%s - insert signal that caused the coredump into the filename 添加導致產生core的信號
%t - insert UNIX time that the coredump occurred into filename 添加core文件生成時的unix時間
%h - insert hostname where the coredump happened into filename 添加主機名
%e - insert coredumping executable name into filename 添加命令名


3 重啟時生效

vim /etc/pam.d/login
增加一行 session required pam_limits.so
session required pam_limits.so


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM