0
点赞
收藏
分享

微信扫一扫

Linux core dump

回溯 2023-09-14 阅读 27


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

Linux core dump_GDB


要理解 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 条评论