【Linux】查看core文件,找出系统崩溃原因

安装gdb

# 在线安装
yum -y install gdb

# 离线安装
# 下载安装包
yumdownloader gdb --resolve --destdir /home/download/gdb
# 安装rpm包
rpm -ivh gdb-7.6.1-120.el7.x86_64.rpm

查看core文件

查看gdb用法

[root@master ~]# gdb
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7
Copyright (C) 2013 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/>.
(gdb) help
List of classes of commands:

aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands

Type "help" followed by a class name for a list of commands in that class.
Type "help all" for the list of all commands.
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb) 

查看core文件

[root@node1 ~]# gdb
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7
Copyright (C) 2013 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/>.
(gdb) core-file core.146495
[New LWP 146573]
[New LWP 146511]
[New LWP 146503]
[New LWP 146592]
[New LWP 146596]
[New LWP 146500]
[New LWP 146508]
[New LWP 146588]
[New LWP 146766]
[New LWP 146540]
[New LWP 146499]
[New LWP 146594]
[New LWP 146504]
[New LWP 146579]
[New LWP 146591]
[New LWP 146498]
[New LWP 146576]
[New LWP 146586]
[New LWP 146518]
[New LWP 146589]
[New LWP 146599]
[New LWP 146509]
[New LWP 146580]
[New LWP 146497]
[New LWP 146501]
[New LWP 146600]
[New LWP 146590]
[New LWP 146595]
[New LWP 146571]
[New LWP 146582]
[New LWP 146507]
[New LWP 146593]
[New LWP 146496]
[New LWP 146570]
[New LWP 146512]
[New LWP 146506]
[New LWP 146495]
[New LWP 146581]
[New LWP 146578]
[New LWP 146566]
[New LWP 146605]
[New LWP 146502]
[New LWP 146577]
[New LWP 146565]
[New LWP 146547]
[New LWP 146516]
[New LWP 146536]
[New LWP 146585]
[New LWP 146741]
[New LWP 146575]
[New LWP 146564]
[New LWP 146556]
[New LWP 146533]
[New LWP 146587]
[New LWP 146514]
[New LWP 146563]
[New LWP 146557]
[New LWP 146550]
[New LWP 146574]
[New LWP 146598]
[New LWP 146517]
[New LWP 146561]
[New LWP 146764]
[New LWP 146510]
[New LWP 146513]
[New LWP 146515]
[New LWP 146560]
[New LWP 146505]
[New LWP 146572]
[New LWP 146597]
[New LWP 146559]
[New LWP 146558]
[New LWP 146583]
[New LWP 146584]
Missing separate debuginfo for the main executable file
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/c9/0f19ee0af98c47ccaa7181853cfd14867bc931
Core was generated by `/home/jdk1.8.0_181/jre/bin/java -Djava.util.logging.config.file=/home'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f0070dcad36 in ?? ()
(gdb) 

能看到是java产生的core

[root@node1 ~]# yum -y --enablerepo='*debug*' --skip-broken install /usr/lib/debug/.build-id/c9/* 
[root@node1 ~]# gdb /home/jdk1.8.0_181/bin/java core.146495
......
[New LWP 146558]
[New LWP 146583]
[New LWP 146584]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /home/kqbigdata/jdk1.8.0_181/jre/lib/amd64/server/libjvm.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/15/e0d7bd922e89a8b5d68810ef4482f758ebcf07.debug
Missing separate debuginfo for /home/kqbigdata/jdk1.8.0_181/jre/lib/amd64/libverify.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/b3/de2701fa3aef182d8e7b2db8d294a91af1eb7c.debug
Missing separate debuginfo for /home/kqbigdata/jdk1.8.0_181/jre/lib/amd64/libmanagement.so
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/1c/946f30cf97aa2c7b5f226a8f8a4dd067bd76af.debug
Core was generated by `/home/kqbigdata/jdk1.8.0_181/jre/bin/java -Djava.util.logging.config.file=/home'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f0070dcad36 in __GI__IO_default_xsputn () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.26-23.el7.x86_64 glibc-2.17-222.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-18.el7.x86_64 libcom_err-1.42.9-11.el7.x86_64 libcurl-7.29.0-46.el7.x86_64 libgcc-4.8.5-28.el7.x86_64 libidn-1.28-4.el7.x86_64 libselinux-2.5-12.el7.x86_64 libssh2-1.4.3-10.el7_2.1.x86_64 nspr-4.17.0-1.el7.x86_64 nss-3.34.0-4.el7.x86_64 nss-softokn-freebl-3.34.0-2.el7.x86_64 nss-util-3.34.0-2.el7.x86_64 openldap-2.4.44-13.el7.x86_64 openssl-libs-1.0.2k-12.el7.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-17.el7.x86_64
(gdb) bt
#0  0x00007f0070dcad36 in __GI__IO_default_xsputn () from /lib64/libc.so.6
#1  0x00007f0070d965a7 in vfprintf () from /lib64/libc.so.6
#2  0x00007f0070d9bcfb in buffered_vfprintf () from /lib64/libc.so.6
#3  0x00007f0070d966be in vfprintf () from /lib64/libc.so.6
#4  0x00007f0070da1297 in fprintf () from /lib64/libc.so.6
#5  0x00007f00295d5b31 in GDALDefaultCSVFilename (pszBasename=0x1 <Address 0x1 out of bounds>) at cpl_csv.cpp:1360
#6  0x00007eff88423750 in ?? ()
#7  0x00007f00297a3d28 in typeinfo name for GDALDataset () from /lib/libgdal.so.28
#8  0x00007f002976d1bb in ?? () from /lib/libgdal.so.28
#9  0x00007eff8b6dc4a0 in ?? ()
#10 0x00007f00295d613e in CPLDebug (pszCategory=0x7f0050fcd660 "\004\200\255", <incomplete sequence \373>, pszFormat=0x7f00296a86a5 "") at cpl_error.cpp:606
#11 0x00007f0050fcffe0 in ?? ()
#12 0x00007f0050fcff20 in ?? ()
#13 0x0000000000000001 in ?? ()
#14 0x0000000000000000 in ?? ()
(gdb) list
1	<built-in>: No such file or directory.
(gdb) 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值