源码下载
官网:
http://people.redhat.com/anderson/
官网新地址:
https://crash-utility.github.io/
不同版本下载地址:
https://github.com/crash-utility/crash/releases
截止到目前,最新版本是crash-7.2.4,crash-7.2.4.tar.gz大概37.4MB
之所以这么大,主要是因为其中包含了gdb-7.6.tar.gz的源码。
编译
我要编译ARM64的crash,具体操作如下:
$ tar -xf crash-7.2.4.tar.gz
$ cd crash-7.2.4/
$ make target=arm64
首次编译时总是报同一个错误,具体信息如下:
我的PC系统是ubuntu16.04
编译输出的关键日志:
TARGET: ARM64
CRASH: 7.2.4
GDB: 7.6
…
Makefile:1174: recipe for target ‘gdb’ failed
Makefile:8264: recipe for target ‘all-gdb’ failed
Makefile:834: recipe for target ‘all’ failed
crash build failed
Makefile:229: recipe for target ‘gdb_merge’ failed
Makefile:224: recipe for target ‘all’ failed
后来安装了一些工具后解决
sudo apt-get install libaio-dev libncurses5-dev zlib1g-dev liblzma-dev flex bison byacc
参考这个博客:
https://blog.csdn.net/paul_liao/article/details/40581869
编译成功后会生成crash文件
$ ./crash
crash 7.2.4
Copyright © 2002-2017 Red Hat, Inc.
Copyright © 2004, 2005, 2006, 2010 IBM Corporation
Copyright © 1999-2006 Hewlett-Packard Co
Copyright © 2005, 2006, 2011, 2012 Fujitsu Limited
Copyright © 2006, 2007 VA Linux Systems Japan K.K.
Copyright © 2005, 2011 NEC Corporation
Copyright © 1999, 2002, 2007 Silicon Graphics, Inc.
Copyright © 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: compiled for the ARM64 architecture
$ ./crash --buildinfo
build_command: crash
build_data: 2018年 12月 30日 星期日 21:26:41 CST by uid=1000(yutao) on yutao
build_target: ARM64
build_version: 7.2.4
compiler version: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609