zloop: check if core file is generated by zdb

Run `gdb` core file inspection with correct program.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Gvozden Neskovic <neskovic@gmail.com>
Closes #5215
This commit is contained in:
Gvozden Neskovic 2016-10-04 00:42:13 +02:00 committed by Brian Behlendorf
parent 62a65a654e
commit 0c313d2f74

View File

@ -70,7 +70,8 @@ coreglob="$(egrep -o '^([^|%[:space:]]*)' /proc/sys/kernel/core_pattern)*"
if [[ $coreglob = "*" ]]; then
echo "Setting core file pattern..."
echo "core" > /proc/sys/kernel/core_pattern
coreglob="$(egrep -o '^([^|%[:space:]]*)' /proc/sys/kernel/core_pattern)*"
coreglob="$(egrep -o '^([^|%[:space:]]*)' \
/proc/sys/kernel/core_pattern)*"
fi
function core_file
@ -78,6 +79,17 @@ function core_file
printf "%s" "$(ls -tr1 $coreglob 2> /dev/null | head -1)"
}
function core_prog
{
prog=$ZTEST
core_id=$($GDB --batch -c $1 | grep "Core was generated by" | \
tr \' ' ')
if [[ "$core_id" =~ "zdb " ]]; then
prog=$ZDB
fi
printf "%s" "$prog"
}
function store_core
{
core="$(core_file)"
@ -99,6 +111,7 @@ function store_core
# check for core
if [[ -f "$core" ]]; then
coreprog=$(core_prog $core)
corestatus=$($GDB --batch --quiet \
-ex "set print thread-events off" \
-ex "printf \"*\n* Backtrace \n*\n\"" \
@ -111,7 +124,7 @@ function store_core
-ex "thread apply all bt" \
-ex "printf \"*\n* Backtraces (full) \n*\n\"" \
-ex "thread apply all bt full" \
-ex "quit" $ZTEST "$core" | grep -v "New LWP")
-ex "quit" $coreprog "$core" | grep -v "New LWP")
# Dump core + logs to stored directory
echo "$corestatus" >>$dest/status