Linux 下core文件分析
原文:http://blog.csdn.net/gobitan/article/details/5644151
Linux平台下的corefile分析
胡家辉2010-05-06
第一步:找到corefile是由哪个程序产生的
[root@app10dennis]#filecore.11751
core.11751:ELF64-bitLSBcorefileAMDx86-64,version1(SYSV),SVR4-style,from'java'
[root@app10dennis]#
从上面可以看出,该corefile是由java产生的。
第二步:用gdb调试器找到问题所在,执行如下命令
[root@app10dennis]#gdbjavacore.11751
GNUgdbFedora(6.8-27.el5)
Copyright(C)2008FreeSoftwareFoundation,Inc.
LicenseGPLv3+:GNUGPLversion3orlater<http://gnu.org/licenses/gpl.html>
Thisisfreesoftware:youarefreetochangeandredistributeit.
ThereisNOWARRANTY,totheextentpermittedbylaw.Type"showcopying"
and"showwarranty"fordetails.
ThisGDBwasconfiguredas"x86_64-redhat-linux-gnu"...
(nodebuggingsymbolsfound)
Readingsymbolsfrom/lib64/libpthread.so.0...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/lib64/libpthread.so.0
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/jli/libjli.so...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/bin/../lib/amd64/jli/libjli.so
Readingsymbolsfrom/lib64/libdl.so.2...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/lib64/libdl.so.2
Readingsymbolsfrom/lib64/libc.so.6...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/lib64/libc.so.6
Readingsymbolsfrom/lib64/ld-linux-x86-64.so.2...
(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/lib64/ld-linux-x86-64.so.2
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so
Readingsymbolsfrom/lib64/libm.so.6...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/lib64/libm.so.6
Readingsymbolsfrom/lib64/librt.so.1...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/lib64/librt.so.1
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/libverify.so...
(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/lib/amd64/libverify.so
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/libjava.so...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/lib/amd64/libjava.so
Readingsymbolsfrom/lib64/libnsl.so.1...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/lib64/libnsl.so.1
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/native_threads/libhpi.so...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/lib/amd64/native_threads/libhpi.so
Readingsymbolsfrom/lib64/libnss_files.so.2...
(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/lib64/libnss_files.so.2
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/libzip.so...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/lib/amd64/libzip.so
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/libnet.so...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/lib/amd64/libnet.so
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/librmi.so...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/lib/amd64/librmi.so
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/libnio.so...
(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/lib/amd64/libnio.so
Readingsymbolsfrom/opt/nawg/lib/libheadercodecJNI.so...(nodebuggingsymbolsfound)...done.
Loadedsymbolsfor/opt/nawg/lib/libheadercodecJNI.so
Readingsymbolsfrom/opt/nawg/lib/libwpss_wsl.so.1...done.
Loadedsymbolsfor/opt/nawg/lib/libwpss_wsl.so.1
Readingsymbolsfrom/opt/nawg/lib/libwpss_hc.so.2...done.
Loadedsymbolsfor/opt/nawg/lib/libwpss_hc.so.2
Readingsymbolsfrom/opt/nawg/lib/libwss_wenc.so...done.
Loadedsymbolsfor/opt/nawg/lib/libwss_wenc.so
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/libawt.so...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/lib/amd64/libawt.so
Readingsymbolsfrom/usr/java/jre1.6.0_19/lib/amd64/headless/libmawt.so...done.
Loadedsymbolsfor/usr/java/jre1.6.0_19/lib/amd64/headless/libmawt.so
Readingsymbolsfrom/opt/nawg/lib/libWIAwmlsencoder.so...done.
Loadedsymbolsfor/opt/nawg/lib/libWIAwmlsencoder.so
Readingsymbolsfrom/opt/nawg/lib/libWIAhtml2xhtml.so...done.
Loadedsymbolsfor/opt/nawg/lib/libWIAhtml2xhtml.so
Readingsymbolsfrom/opt/nawg/lib/libcapcodecJNI.so...done.
Loadedsymbolsfor/opt/nawg/lib/libcapcodecJNI.so
Readingsymbolsfrom/opt/nawg/lib/libwpss.so.4...done.
Loadedsymbolsfor/opt/nawg/lib/libwpss.so.4
Readingsymbolsfrom/opt/nawg/lib/libserverJNI.so...done.
Loadedsymbolsfor/opt/nawg/lib/libserverJNI.so
Readingsymbolsfrom/opt/nawg/lib/libwpss_crypto.so.1...done.
Loadedsymbolsfor/opt/nawg/lib/libwpss_crypto.so.1
Readingsymbolsfrom/opt/nawg/lib/libcrypto.so.0.9.8...done.
Loadedsymbolsfor/opt/nawg/lib/libcrypto.so.0.9.8
Readingsymbolsfrom/usr/lib/oracle/10.2.0.2/client/lib/libocijdbc10.so...done.
Loadedsymbolsfor/usr/lib/oracle/10.2.0.2/client/lib/libocijdbc10.so
Readingsymbolsfrom/usr/lib/oracle/10.2.0.2/client/lib/libclntsh.so.10.1...done.
Loadedsymbolsfor/usr/lib/oracle/10.2.0.2/client/lib/libclntsh.so.10.1
Readingsymbolsfrom/usr/lib/oracle/10.2.0.2/client/lib/libnnz10.so...done.
Loadedsymbolsfor/usr/lib/oracle/10.2.0.2/client/lib/libnnz10.so
Readingsymbolsfrom/usr/lib/oracle/10.2.0.2/client/lib/libociicus.so...done.
Loadedsymbolsfor/usr/lib/oracle/10.2.0.2/client/lib/libociicus.so
Corewasgeneratedby`java-server-DWAPHOME=/opt/nawg/log/wps_var-DsystemRoot=/opt/nawg-DsystemBin'.
Programterminatedwithsignal6,Aborted.
[Newprocess12593]
[Newprocess22363]
【中间省略掉了】
[Newprocess11752]
[Newprocess11751]
#00x00002b08894f4215inraise()from/lib64/libc.so.6
然后执行bt命令
(gdb)bt
#00x00002b08894f4215inraise()from/lib64/libc.so.6
#10x00002b08894f5cc0inabort()from/lib64/libc.so.6
#20x00002b0889df13d7inos::abort()from/usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so
#30x00002b0889f2a50dinVMError::report_and_die()from/usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so
#40x00002b0889df74c1inJVM_handle_linux_signal()from/usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so
#50x00002b0889df3cfeinsignalHandler()from/usr/java/jre1.6.0_19/lib/amd64/server/libjvm.so
#6<signalhandlercalled>
#70x00002aaaec5dd0bdindeclex(yylval=<valueoptimizedout>,DecParam=0x572dd840)atlex_dec.c:7997
#80x00002aaaec5e15c5indecparse(DecParam=0x572dd840)atyacc_dec.c:1008
#90x00002aaaec5d4ff1inHC_DecodeHeader(Context=0x564b62f0,WspHeader=<valueoptimizedout>,WspHeaderLength=4096,
ContentLength=0,HttpHeader=0x5636a390"B$¨ÉB$:/r/n",HttpHeaderLength=0x43caa814)athc_decoder.c:2517
#100x00002aaaec3b2dbeinJava_com_nokia_wap_filter_headercodec_HeaderCodec_cDecode()
from/opt/nawg/lib/libheadercodecJNI.so
#110x00002aaaab866058in??()
#120x0000000043caa8b0in??()
#130x0000000000000000in??()
(gdb)
从上面bt命令获取到的堆栈信息来看,可以清晰地看到问题所在的源代码的行数,即:
hc_decoder.c:2517
这样就便于分析和定位问题。