Linux core dump

core file 的目录

$ cat /proc/sys/kernel/core_pattern
/data/corefile/core_%e_%t
$ cat /proc/sys/kernel/core_uses_pid
1

%e,  %t 的含义查看 man core

If the /proc/sys/kernel/core_uses_pid file contains the value 0, then a core dump file is simply named core.  If this file contains a non-zero value, then the core dump file includes the process ID in a name of the form core.PID.

$ ls /data/corefile
core_tdr_1419828301.21369     core_tdr_1419828704.26256

core file 大小限制——ulimit



要理解 ulimit 必须先理解 ulimit 的 hard limit 和 soft limit:

hard limit 仅 root 可以修改,soft limit 每个用户都可以修改,但是不能超过 hard limit, 而且每个用户有自己的 soft limit.

-H: hard

-S: soft

-H, -S 可以和其它选项叠加,如 -c(core).


用 GDB 调试 core file

$ gdb program core
也有其它方式调试,这里不再赘述。需要注意的是, 如果 program 有输入参数,调试 core file 的时候不需要输入参数(用 gdb 单独调试 program 时需要参数),否则会出现找不到符号表的问题:

Program terminated with signal 11, Segmentation fault.
#0  0x0000000000634331 in ?? ()
(gdb) where
#0  0x0000000000634331 in ?? ()
#1  0x00000000008cb5a0 in ?? ()
#2  0x0000000000000006 in ?? ()
#3  0x00007fff5d895d40 in ?? ()
#4  0x0000000000000000 in ?? ()




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值