1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-25 07:49:18 +00:00

Support compressed crash dumps in crashinfo(8).

Temporarily decompress a copy of a crash dump compressed with either
gzip or zstd and run various tools against the decompressed copy while
generating the crash information.  The uncompressed copy is deleted when
the script exits.

Note that crashinfo is enabled by default, so this will attempt to
decompress the most recent compressed crash dump after a crash that
generates a compressed crash dump.  Users who wish to only do offline
analysis of compressed crash dumps can disable crashinfo in rc.conf.

Tested by:	ler
Reviewed by:	markj
MFC after:	2 weeks
This commit is contained in:
John Baldwin 2018-07-23 18:08:56 +00:00
parent c798532ffa
commit 6f77212f27
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336645

View File

@ -38,6 +38,13 @@ usage()
exit 1
}
# Remove an uncompressed copy of a dump
cleanup()
{
[ -e $VMCORE ] && rm -f $VMCORE
}
# Find a gdb binary to use and save the value in GDB.
find_gdb()
{
@ -133,7 +140,7 @@ if [ $# -eq 1 ]; then
# Figure out the crash directory and number from the vmcore name.
CRASHDIR=`dirname $1`
DUMPNR=$(expr $(basename $1) : 'vmcore\.\([0-9]*\)$')
DUMPNR=$(expr $(basename $1) : 'vmcore\.\([0-9]*\)')
if [ -z "$DUMPNR" ]; then
echo "Unable to determine dump number from vmcore file $1."
exit 1
@ -174,8 +181,16 @@ if [ -z "$GDB" ]; then
fi
if [ ! -e $VMCORE ]; then
echo "$VMCORE not found"
exit 1
if [ -e $VMCORE.gz ]; then
trap cleanup EXIT HUP INT QUIT TERM
gzcat $VMCORE.gz > $VMCORE
elif [ -e $VMCORE.zst ]; then
trap cleanup EXIT HUP INT QUIT TERM
zstdcat $VMCORE.zst > $VMCORE
else
echo "$VMCORE not found"
exit 1
fi
fi
if [ ! -e $INFO ]; then