diff options
-rwxr-xr-x | scripts/zloop.sh | 17 |
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 |