Linux dump 文件分析


当 linux 系统内核发生崩溃的时候,可以通过 kdump 等方式收集内核崩溃之前的内存,生成一个转储文件 vmcore , crash 是一个广泛使用的内核崩溃转储文件分析工具.

Kdump 是一种基于 kexec 的内存转储工具,目前它已经被内核主线接收,成为了内核的一部分,它也由此获得了绝大多数 Linux 发行版的支持。与传统的内存转储机制不同不同,基于 Kdump 的系统工作的时候需要两个内核,一个称为系统内核,即系统正常工作时运行的内核;另外一个称为捕获内核,即正常内核崩溃时,用来进行内存转储的内核。


#### 工具准备

uname -r 
2.6.32-696.el6.x86_64
拿到内核版本号,去下面链接下载对应的包
http://debuginfo.centos.org/6/x86_64/

kernel-debuginfo-2.6.32-696.el6.x86_64.rpm
kernel-debuginfo-common-x86_64-2.6.32-696.el6.x86_64.rpm

rpm -ivh kernel-debuginfo-2.6.32-696.el6.x86_64.rpm;
rpm -ivh kernel-debuginfo-common-x86_64-2.6.32-696.el6.x86_64.rpm;

#### crash 内置命令简介

    bt - backtrace
        bt 命令用于查看系统崩溃前的堆栈等信息,这是系统调试中非常常用和好用的一个命令。
    log - dump system message buffer
        log 命令可以打印系统消息缓冲区,从而可能找到系统崩溃的线索
    ps - display process status information
        ps 命令用于显示进程的状态,(如图)带 > 标识代表是活跃的进程。
    dis - disassembling instruction
        dis 命令用于对给定地址的内容进行反汇编。
        

#### 分析

用crash命令打开vmcore

# crash  /usr/lib/debug/lib/modules/2.6.32-431.el6.x86_64/vmlinux /var/crash/127.0.0.1-2019-07-25-23\:49\:55/vmcore
crash 7.1.0-8.el6
Copyright (C) 2002-2014  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 warr
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值