summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGvozden Neskovic <[email protected]>2016-10-04 00:42:13 +0200
committerBrian Behlendorf <[email protected]>2016-10-03 15:42:13 -0700
commit0c313d2f7451041e9cc952fe68fb500efef52fe1 (patch)
treef2e140cbbde16275288726075fbd14147c440ae0
parent62a65a654e15a1388bfb571727e69b46e7cc07ab (diff)
zloop: check if core file is generated by zdb
Run `gdb` core file inspection with correct program. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Gvozden Neskovic <[email protected]> Closes #5215
-rwxr-xr-xscripts/zloop.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/zloop.sh b/scripts/zloop.sh
index 8125229a8..580fcfe40 100755
--- a/scripts/zloop.sh
+++ b/scripts/zloop.sh
@@ -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