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:
parent
c798532ffa
commit
6f77212f27
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user