Linux平臺下的core file分析
轉載自CSDN博客:http://blog.csdn.net/gobitan/article/details/5644151
第一步:找到core file是由哪個程序產生的
[[email protected] dennis]# file core.11751
core.11751: ELF 64-bit LSB core file AMD x86-64, version 1 (SYSV), SVR4-style, from ‘Java‘
[[email protected] dennis]#
從上面可以看出,該core file是由java產生的。
第二步:用gdb
[[email protected] 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分析