首页 > 代码库 > Linux平台下的core file分析
Linux平台下的core file分析
转载自CSDN博客:http://blog.csdn.net/gobitan/article/details/5644151
第一步:找到core file是由哪个程序产生的
[root@app10 dennis]# file core.11751
core.11751: ELF 64-bit LSB core file AMD x86-64, version 1 (SYSV), SVR4-style, from ‘Java‘
[root@app10 dennis]#
从上面可以看出,该core file是由java产生的。
第二步:用gdb调试器找到问题所在,执行如下命令
[root@app10 dennis]# gdb Java core.11751
GNU gdb Fedora (6.8-27.el5)
Copyright (C) 2008 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"...
(no debugging symbols found)
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done.
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/jli/libjli.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jre1.6.0_19/bin/../lib/amd64/jli/libjli.so
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...
(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/libverify.so...
(no debugging symbols found)...done.
Loaded symbols for /usr/java/jre1.6.0_19/lib/amd64/libverify.so
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/libjava.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jre1.6.0_19/lib/amd64/libjava.so
Reading symbols from /lib64/libnsl.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnsl.so.1
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/native_threads/libhpi.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jre1.6.0_19/lib/amd64/native_threads/libhpi.so
Reading symbols from /lib64/libnss_files.so.2...
(no debugging symbols found)...done.
Loaded symbols for /lib64/libnss_files.so.2
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/libzip.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jre1.6.0_19/lib/amd64/libzip.so
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/libnet.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jre1.6.0_19/lib/amd64/libnet.so
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/librmi.so...(no debugging symbols found)...done.
Loaded symbols for /usr/java/jre1.6.0_19/lib/amd64/librmi.so
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/libnio.so...
(no debugging symbols found)...done.
Loaded symbols for /usr/java/jre1.6.0_19/lib/amd64/libnio.so
Reading symbols from /opt/nawg/lib/libheadercodecJNI.so...(no debugging symbols found)...done.
Loaded symbols for /opt/nawg/lib/libheadercodecJNI.so
Reading symbols from /opt/nawg/lib/libwpss_wsl.so.1...done.
Loaded symbols for /opt/nawg/lib/libwpss_wsl.so.1
Reading symbols from /opt/nawg/lib/libwpss_hc.so.2...done.
Loaded symbols for /opt/nawg/lib/libwpss_hc.so.2
Reading symbols from /opt/nawg/lib/libwss_wenc.so...done.
Loaded symbols for /opt/nawg/lib/libwss_wenc.so
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/libawt.so...done.
Loaded symbols for /usr/java/jre1.6.0_19/lib/amd64/libawt.so
Reading symbols from /usr/java/jre1.6.0_19/lib/amd64/headless/libmawt.so...done.
Loaded symbols for /usr/java/jre1.6.0_19/lib/amd64/headless/libmawt.so
Reading symbols from /opt/nawg/lib/libWIAwmlsencoder.so...done.
Loaded symbols for /opt/nawg/lib/libWIAwmlsencoder.so
Reading symbols from /opt/nawg/lib/libWIAhtml2xhtml.so...done.
Loaded symbols for /opt/nawg/lib/libWIAhtml2xhtml.so
Reading symbols from /opt/nawg/lib/libcapcodecJNI.so...done.
Loaded symbols for /opt/nawg/lib/libcapcodecJNI.so
Reading symbols from /opt/nawg/lib/libwpss.so.4...done.
Loaded symbols for /opt/nawg/lib/libwpss.so.4
Reading symbols from /opt/nawg/lib/libserverJNI.so...done.
Loaded symbols for /opt/nawg/lib/libserverJNI.so
Reading symbols from /opt/nawg/lib/libwpss_crypto.so.1...done.
Loaded symbols for /opt/nawg/lib/libwpss_crypto.so.1
Reading symbols from /opt/nawg/lib/libcrypto.so.0.9.8...done.
Loaded symbols for /opt/nawg/lib/libcrypto.so.0.9.8
Reading symbols from /usr/lib/Oracle/10.2.0.2/client/lib/libocijdbc10.so...done.
Loaded symbols for /usr/lib/oracle/10.2.0.2/client/lib/libocijdbc10.so
Reading symbols from /usr/lib/oracle/10.2.0.2/client/lib/libclntsh.so.10.1...done.
Loaded symbols for /usr/lib/oracle/10.2.0.2/client/lib/libclntsh.so.10.1
Reading symbols from /usr/lib/oracle/10.2.0.2/client/lib/libnnz10.so...done.
Loaded symbols for /usr/lib/oracle/10.2.0.2/client/lib/libnnz10.so
Reading symbols from /usr/lib/oracle/10.2.0.2/client/lib/libociicus.so...done.
Loaded symbols for /usr/lib/oracle/10.2.0.2/client/lib/libociicus.so
Core was generated by `java -server -DWAPHOME=/opt/nawg/log/wps_var -DsystemRoot=/opt/nawg -DsystemBin‘.
Program terminated with signal 6, Aborted.
[New process 12593]
[New process 22363]
【中间省略掉了】
[New process 11752]
[New process 11751]
#0 0x00002b08894f4215 in raise () from /lib64/libc.so.6
然后执行bt命令
(gdb) bt
#0 0x00002b08894f4215 in raise () from /lib64/libc.so.6
#1 0x00002b08894f5cc0 in abort () from /lib64/libc.so.6
#2 0x00002b0889df13d7 in os::abort () from /usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so
#3 0x00002b0889f2a50d in VMError::report_and_die () from /usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so
#4 0x00002b0889df74c1 in JVM_handle_linux_signal () from /usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so
#5 0x00002b0889df3cfe in signalHandler () from /usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so
#6 <signal handler called>
#7 0x00002aaaec5dd0bd in declex (yylval=<value optimized out>, DecParam=0x572dd840) at lex_dec.c:7997
#8 0x00002aaaec5e15c5 in decparse (DecParam=0x572dd840) at yacc_dec.c:1008
#9 0x00002aaaec5d4ff1 in HC_DecodeHeader (Context=0x564b62f0, WspHeader=<value optimized out>, WspHeaderLength=4096,
ContentLength=0, HttpHeader=0x5636a390 "B$¨éB$: /r/n", HttpHeaderLength=0x43caa814) at hc_decoder.c:2517
#10 0x00002aaaec3b2dbe in Java_com_nokia_wap_filter_headercodec_HeaderCodec_cDecode ()
from /opt/nawg/lib/libheadercodecJNI.so
#11 0x00002aaaab866058 in ?? ()
#12 0x0000000043caa8b0 in ?? ()
#13 0x0000000000000000 in ?? ()
(gdb)
从上面bt命令获取到的堆栈信息来看,可以清晰地看到问题所在的源代码的行数,即:
hc_decoder.c:2517
这样就便于分析和定位问题。
参考文献:
(1)http://www.dialogic.com/support/helpweb/dxall/tn957.aspx
(2)http://www.sun.com/bigadmin/jsp/descFile.jsp?url=descAll/sun_gdd__all__pkg_a
Linux平台下的core file分析