Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1606248
  • 博文数量: 695
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4027
  • 用 户 组: 普通用户
  • 注册时间: 2013-11-20 21:22
文章分类

全部博文(695)

文章存档

2018年(18)

2017年(74)

2016年(170)

2015年(102)

2014年(276)

2013年(55)

分类: LINUX

2014-06-21 15:11:24


试了很多办法都没生成core文件,我用是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 “core-%e-%p-%t” > /proc/sys/kernel/core_pattern)
以下是参数列表:
    %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 添加命令名

在运行可执行程序后,就可以在当前目录下看到core文件了
使用 gdb  ./可执行程序文件名 ./core
就可以调试了






参考文章:http://blog.csdn.net/shaovey/article/details/2744487
阅读(3490) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~