diff options
author | John Baldwin <jhb@FreeBSD.org> | 2018-07-23 18:08:56 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2018-07-23 18:08:56 +0000 |
commit | 6f77212f270f7644575fe3705ed2596eafe0577d (patch) | |
tree | 679e35975fccbae8ddf2fea117842db8d072056f /usr.sbin | |
parent | c798532ffa445cc95e4099e94081f7220c6cf0c9 (diff) | |
download | src-test-6f77212f270f7644575fe3705ed2596eafe0577d.tar.gz src-test-6f77212f270f7644575fe3705ed2596eafe0577d.zip |
Notes
Diffstat (limited to 'usr.sbin')
-rwxr-xr-x | usr.sbin/crashinfo/crashinfo.sh | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/usr.sbin/crashinfo/crashinfo.sh b/usr.sbin/crashinfo/crashinfo.sh index fdf13b79bc26d..46ba2ffde293c 100755 --- a/usr.sbin/crashinfo/crashinfo.sh +++ b/usr.sbin/crashinfo/crashinfo.sh @@ -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 |