#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # # # Licensed Materials - Property of IBM # # (C) COPYRIGHT International Business Machines Corp. 2001,2006 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)20 1.6.1.2 src/avs/fs/mmfs/ts/admin/mmdumpkthreads.sh, mmfs, avs_rgpfs24, rgpfs24s007a 10/19/06 18:09:18 ########################################################################## # # Dump information about the kernel threads. # # Usage: mmdumpkthreads [dump [kernelfile]] # # where # dump is the system image file. # # kernelfile is a file with the kernel symbol definititions. # ########################################################################## sourceFile="mmdumpkthreads.sh" [[ -n $DEBUG || -n $DEBUGmmdumpkthreads ]] && set -x crash=/usr/sbin/crash kdb=/usr/sbin/kdb lcrash=/sbin/lcrash osName=$(/bin/uname -s) if [[ -x $SHARKCLONEROOT/kernext/gpl-linux/kdump ]] then kdump=$SHARKCLONEROOT/kernext/gpl-linux/kdump elif [[ -x /usr/lpp/mmfs/src/gpl-linux/kdump ]] then kdump=/usr/lpp/mmfs/src/gpl-linux/kdump elif [[ -x /usr/lpp/mmfs/kernext/gpl-linux/kdump ]] then kdump=/usr/lpp/mmfs/kernext/gpl-linux/kdump fi if [[ $1 = '-?' || $1 = '-h' || $1 = '--help' || $1 = '--' ]] then print -u2 "Usage: mmdumpkthreads [dump [kernelfile]]" exit 1 fi if [[ -x $lcrash ]] then # Linux lcrash debugger print "task" | $lcrash | \ /bin/awk ' \ /^\s*0x[a-f0-9]+/ { \ print "task ", $1; \ print "bt ", $1; \ } \ END { \ print "quit"; \ } \ ' | \ $lcrash elif [[ $osName = Linux ]] then ps axuwww [[ $kdump != "" ]] && print "bta" | $kdump /var/mmfs/tmp/complete.map.latest elif [[ -x $crash ]] then # AIX pre-rel5 crash debugger print "th" | $crash $1 $2 2>/dev/null | \ /usr/bin/awk ' \ /^[ ]*[0-9]+ / { \ print "th", $1; \ print "t -k", $1; \ } \ ' | \ $crash $1 $2 2> /dev/null else # AIX rel5 kdb debugger print "th *" | $kdb $1 $2 2>/dev/null | /usr/bin/awk '{ if ($1=="SLOT") { ok=1; getline; } else if (ok==1 && $2 != "") { print "th", $2+0; print "where", $2+0; } }' | $kdb $1 $2 2> /dev/null | /usr/bin/awk ' /SLOT NAME/ { print ""; print $0; getline; if (NF==0) getline; print $0 while (getline && index($0,"> where ") <= 0) x++ print $0; getline while (getline && index($0,"> th ") <= 0) print $0 }' fi exit 0