原文:http://blog.csdn.net/gobitan/article/details/5644151
Linux平台下的core file分析
胡家辉 2010-05-06
第一步:找到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
这样就便于分析和定位问题。
分享到:
相关推荐
core文件是Linux下非常有用的调试工具之一,通过合理地设置core文件的生成与命名规则,并结合使用GDB和其他辅助工具,我们可以有效地定位程序中的错误,解决复杂的问题。此外,掌握core文件的高级调试技巧,如多线程...
首先,我们使用 arm-fsl-linux-gnueabi-gdb 命令来分析 Core Dump 文件: ``` arm-fsl-linux-gnueabi-gdb -c core-tsk_mvm_Main-2533-11 ``` 然后,我们将 rootfs/opt/ftl/apl/ 目录中的 PROC_MMP 文件拷贝到 Core...
通过以上步骤,我们可以有效地在Linux环境下生成和分析core dump文件,这对于调试程序崩溃的原因具有重要的作用。特别是对于开发人员来说,合理配置core dump文件的生成规则,能够大大提升故障排查的效率,从而更快...
### Linux生成Core文件详解 在Linux环境中,当一个程序出现异常终止时,系统可以自动生成一个称为core dump的...总之,core文件是Linux下进行程序调试的重要工具之一,合理配置和利用它可以显著提高问题定位的效率。
在Linux中,当进程收到某些信号时,比如SIGABRT(调用abort函数时)、SIGQUIT(用户按下Ctrl-\时)、SIGSEGV(发生无效的内存访问,即段错误)等,系统可能会生成core文件。默认情况下,core文件的生成与否以及大小...
在嵌入式 Linux 操作系统中执行该文件,然后在执行程序的当前目录下将生成一个 core 文件。 三、coredump 文件的生成 在嵌入式 Linux 操作系统中执行编译生成的文件时,如果程序崩溃了,系统将生成一个 coredump ...
总之,理解如何在Linux中生成和分析core dump文件是软件开发者必备的技能之一。它可以帮助我们快速定位程序中的错误,特别是那些难以复现的问题。通过熟练运用`ulimit`和GDB,我们可以更有效地调试和修复代码,提升...
综合以上知识点,Linux Core Dump文件是分析系统问题和程序错误的重要工具。管理员和开发者通过配置和使用ulimit、core_pattern等系统设置,以及采用gdb等调试工具,能够对程序的异常终止进行深入的分析,帮助发现和...
下面我们将详细探讨Linux下core文件的生成、配置和使用方法。 1. **core文件简介** 当一个程序由于某种原因(如段错误、除零错误等)崩溃时,系统默认可能会生成一个core文件。这个文件包含了程序崩溃时的内存快照...
在Linux中,当进程收到这些信号时,如果系统允许生成core文件,且core文件大小未被限制为0,内核就会将进程的内存状态保存到一个名为"core"的文件中,位于进程的工作目录下。 生成core文件并不是POSIX标准的一部分...
### Linux下产生Core Dump文件及使用GDB调试详解 #### 一、Core文件的基本概念与作用 当一个程序因为某些原因而崩溃时,系统内核会自动创建一个名为`core`的文件,这个文件包含了程序崩溃时刻的内存映像以及其他...
本文将详细介绍如何在Linux环境下设置core文件生成,并且编写相应的代码,以便在程序出现段错误时能够获取内存的核心转储文件。 首先,需要了解的是core文件的生成开关以及大小限制。Linux系统默认情况下可能会关闭...
通常在 Linux 下遇到程序异常退出或者中止,我们都会使用 core 文件进行分析,其中包含了程序运行时的内存,寄存器,堆栈指针等信息,格式为 ELF ,可以理解是程序工作当前状态转储成一个文件,通过工具分析这个文件...
在Linux环境下,C++和Qt开发中,生成和调试Core文件是排查程序错误的重要手段。Core文件是由操作系统在程序异常终止时自动生成的一种二进制文件,它包含了程序崩溃时的内存映像、堆栈信息、寄存器状态等关键数据,对...
《Linux下数据库PostgreSQL分析与应用》这篇文档主要探讨了在Linux操作系统中使用PostgreSQL数据库的各个方面,包括其特性、体系结构、用户管理和可扩展性,并介绍了数据库应用开发接口及编译方法。PostgreSQL是一种...
Linux操作系统中的core文件是当一个程序异常终止时生成的一种特殊文件,它包含了程序崩溃时的内存映像和调试信息,这对于开发者来说是诊断和解决问题的关键工具。本文将深入讲解Linux core文件的相关知识点。 1. **...