尝试了很多方法都没有生成核心文件。 我在使用ubuntu系统
制作两个后,在当前目录下生成core文件,可以使用gdb调试
1、修改ulimit -c filesize、core文件的大小,首先可以在ulimit -a中看到与core file size对应的值
2、修改/proc/sys/kernel/core_pattern内容: ehco core/proc/sys/kernel/core _ pattern
(ehco“核心- % e-% p-% t”/proc/sys/kernel/core _ pattern )
以下是参数列表:
添加%p-insertPIDintofilenamePID
% u-insertcurrentuidintofilename将添加当前uid
% g-insertcurrentgidintofilename添加当前GID
% s-insertsignalthatcausedthecoredumpintothefilename添加导致核心的信号
% t-insertunixtimethatthecoredumpoccurredintofilename生成附加核心文件时的UNIX时间
添加% h-inserthostnamewherethecoredumphappenedintofilename主机名
添加% e-insertcoredumpingexecutablenameintofilename命令名称
运行可执行程序时,核心文件将显示在当前目录下
使用gdb ./可执行文件名称./core
可以调试
文章: http://blog.csdn.net/Shao vey/article/details/2744487
阅读(1860 ) |评论(0) |转发)0|