如何在Ubuntu 12.04上读取崩溃文件?

10

php5-fpm崩溃了,我们想知道当时正在执行什么。由于这种情况发生在生产环境中,因此无法通过xdebug获得信息。

我将失败的实例驱动器挂载到另一个实例(/mnt),并尝试读取崩溃文件:

版本信息

root@dev:/mnt/var/crash# cat /mnt/etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.4 LTS"
尝试使用gdb打开崩溃文件,但无法识别:
root@dev:/mnt/var/crash# gdb /mnt/usr/sbin/php5-fpm _usr_sbin_php5-fpm.1002.crash 
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 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-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /mnt/usr/sbin/php5-fpm...(no debugging symbols found)...done.
"/mnt/var/crash/_usr_sbin_php5-fpm.1002.crash" is not a core dump: File format not recognized

接着尝试崩溃:

root@dev:/mnt/var/crash# crash _usr_sbin_php5-fpm.1002.crash 

crash 6.1.6
Copyright (C) 2002-2013  Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010  IBM Corporation
Copyright (C) 1999-2006  Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012  Fujitsu Limited
Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011  NEC Corporation
Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions.  Enter "help copying" to see the conditions.
This program has absolutely no warranty.  Enter "help warranty" for details.

crash: _usr_sbin_php5-fpm.1002.crash: not a supported file format
文件本身包含一些基本信息,但其中的实质内容似乎是base64编码的:
[...]
Signal: 11
Uname: Linux 3.2.0-59-virtual x86_64
UserGroups:
CoreDump: base64
 H4sICAAAAAAC/0NvcmVEdW1wAA==
[...]

有什么办法可以阅读这个吗?


“crash” 用于内核崩溃转储,而不是进程核心转储。对于核心转储,请使用调试器,例如“gdb”。但要对其进行任何有用的操作,您需要具有调试符号的可执行文件。 - Barmar
@Barmar..所以我无法通过这个崩溃文件获取崩溃时的系统调用堆栈跟踪?太没用了。。 - U0001
1个回答

10
你想阅读关于“如何使用这些崩溃报告?”部分的内容,请在这里查看。
使用apport-unpack解压核心转储文件,GDB将能够进行分析。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接