core文件被截断问题的解决办法

现象
通过gdb打开core,但看不到core的内容,信息如下:

$ gdb XXX core.XXX
GNU gdb (GDB) Red Hat Enterprise Linux ( 7.0.1-32.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/XXX/XXX...done.
BFD: Warning: /home/XXX/core.XXX is truncated: expected core file size >= 747175936, found: 1236992.

warning: core file may not match specified executable file.
Cannot access memory at address 0x344201cc88

调查
ulimit -a的结果如下:

core file size          (blocks, -c) 1000
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 40960
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65000
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 536870912
real-time priority              (-r) 0
stack size              (kbytes, -s) 1024000
cpu time               (seconds, -t) unlimited
max user processes              (-u) 40960
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

经别人指点,说是“core file size”的值太小了。

修改core file size的方法
1 使用root用户登录,在/etc/security/limits.conf文件中,添加了“* hard core unlimited”行,添加后此文件的内容大致如下:

# /etc/security/limits.conf
#
# Each line describes a limit for a user in the form:
#
# <domain> <type> <item> <value>
#
* - msgqueue 536870912
* soft nofile 65000
* hard nofile 65000
* soft core   unlimited
* hard core   unlimited

2 修改这个文件后,退出root用户
3 退出自己的账户的全部登录的终端,然后关闭telnet工具,重新使用自己的账户登录系统,键入下面的命令,都会返回unlimited

$ ulimit -S -c
unlimited
$ ulimit -H -c
unlimited

此时core文件就不会被截断了。

参考资料
How do I enable core dumps for everybody
http://www.akadia.com/services/ora_enable_core.html

原文地址: http://blog.sina.com.cn/s/blog_537f4d9b0100wi88.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值