1 | #!/bin/ksh |
---|
2 | # IBM_PROLOG_BEGIN_TAG |
---|
3 | # This is an automatically generated prolog. |
---|
4 | # |
---|
5 | # |
---|
6 | # |
---|
7 | # Licensed Materials - Property of IBM |
---|
8 | # |
---|
9 | # (C) COPYRIGHT International Business Machines Corp. 2001,2006 |
---|
10 | # All Rights Reserved |
---|
11 | # |
---|
12 | # US Government Users Restricted Rights - Use, duplication or |
---|
13 | # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. |
---|
14 | # |
---|
15 | # IBM_PROLOG_END_TAG |
---|
16 | # @(#)20 1.6.1.2 src/avs/fs/mmfs/ts/admin/mmdumpkthreads.sh, mmfs, avs_rgpfs24, rgpfs24s007a 10/19/06 18:09:18 |
---|
17 | ########################################################################## |
---|
18 | # |
---|
19 | # Dump information about the kernel threads. |
---|
20 | # |
---|
21 | # Usage: mmdumpkthreads [dump [kernelfile]] |
---|
22 | # |
---|
23 | # where |
---|
24 | # dump is the system image file. |
---|
25 | # |
---|
26 | # kernelfile is a file with the kernel symbol definititions. |
---|
27 | # |
---|
28 | ########################################################################## |
---|
29 | |
---|
30 | sourceFile="mmdumpkthreads.sh" |
---|
31 | [[ -n $DEBUG || -n $DEBUGmmdumpkthreads ]] && set -x |
---|
32 | |
---|
33 | crash=/usr/sbin/crash |
---|
34 | kdb=/usr/sbin/kdb |
---|
35 | lcrash=/sbin/lcrash |
---|
36 | osName=$(/bin/uname -s) |
---|
37 | if [[ -x $SHARKCLONEROOT/kernext/gpl-linux/kdump ]] |
---|
38 | then |
---|
39 | kdump=$SHARKCLONEROOT/kernext/gpl-linux/kdump |
---|
40 | elif [[ -x /usr/lpp/mmfs/src/gpl-linux/kdump ]] |
---|
41 | then |
---|
42 | kdump=/usr/lpp/mmfs/src/gpl-linux/kdump |
---|
43 | elif [[ -x /usr/lpp/mmfs/kernext/gpl-linux/kdump ]] |
---|
44 | then |
---|
45 | kdump=/usr/lpp/mmfs/kernext/gpl-linux/kdump |
---|
46 | fi |
---|
47 | |
---|
48 | if [[ $1 = '-?' || $1 = '-h' || $1 = '--help' || $1 = '--' ]] |
---|
49 | then |
---|
50 | print -u2 "Usage: mmdumpkthreads [dump [kernelfile]]" |
---|
51 | exit 1 |
---|
52 | fi |
---|
53 | |
---|
54 | if [[ -x $lcrash ]] |
---|
55 | then # Linux lcrash debugger |
---|
56 | |
---|
57 | print "task" | $lcrash | \ |
---|
58 | /bin/awk ' \ |
---|
59 | /^\s*0x[a-f0-9]+/ { \ |
---|
60 | print "task ", $1; \ |
---|
61 | print "bt ", $1; \ |
---|
62 | } \ |
---|
63 | END { \ |
---|
64 | print "quit"; \ |
---|
65 | } \ |
---|
66 | ' | \ |
---|
67 | $lcrash |
---|
68 | |
---|
69 | elif [[ $osName = Linux ]] |
---|
70 | then |
---|
71 | ps axuwww |
---|
72 | [[ $kdump != "" ]] && print "bta" | $kdump /var/mmfs/tmp/complete.map.latest |
---|
73 | elif [[ -x $crash ]] |
---|
74 | then # AIX pre-rel5 crash debugger |
---|
75 | |
---|
76 | print "th" | $crash $1 $2 2>/dev/null | \ |
---|
77 | /usr/bin/awk ' \ |
---|
78 | /^[ ]*[0-9]+ / { \ |
---|
79 | print "th", $1; \ |
---|
80 | print "t -k", $1; \ |
---|
81 | } \ |
---|
82 | ' | \ |
---|
83 | $crash $1 $2 2> /dev/null |
---|
84 | |
---|
85 | else # AIX rel5 kdb debugger |
---|
86 | |
---|
87 | print "th *" | $kdb $1 $2 2>/dev/null | |
---|
88 | /usr/bin/awk '{ |
---|
89 | if ($1=="SLOT") { |
---|
90 | ok=1; |
---|
91 | getline; |
---|
92 | } else if (ok==1 && $2 != "") { |
---|
93 | print "th", $2+0; |
---|
94 | print "where", $2+0; |
---|
95 | } |
---|
96 | }' | |
---|
97 | |
---|
98 | $kdb $1 $2 2> /dev/null | |
---|
99 | |
---|
100 | /usr/bin/awk ' /SLOT NAME/ { |
---|
101 | print ""; print $0; getline; if (NF==0) getline; print $0 |
---|
102 | while (getline && index($0,"> where ") <= 0) x++ |
---|
103 | print $0; getline |
---|
104 | while (getline && index($0,"> th ") <= 0) print $0 |
---|
105 | }' |
---|
106 | |
---|
107 | fi |
---|
108 | |
---|
109 | exit 0 |
---|
110 | |
---|