Wed, 27 Apr 2016 01:25:04 +0800
Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17
aoqi@0 | 1 | #!/bin/ksh |
aoqi@0 | 2 | # |
aoqi@0 | 3 | # Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 4 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 5 | # |
aoqi@0 | 6 | # This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 7 | # under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 8 | # published by the Free Software Foundation. |
aoqi@0 | 9 | # |
aoqi@0 | 10 | # This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 13 | # version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 14 | # accompanied this code). |
aoqi@0 | 15 | # |
aoqi@0 | 16 | # You should have received a copy of the GNU General Public License version |
aoqi@0 | 17 | # 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 19 | # |
aoqi@0 | 20 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 21 | # or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 22 | # questions. |
aoqi@0 | 23 | # |
aoqi@0 | 24 | # |
aoqi@0 | 25 | |
aoqi@0 | 26 | |
aoqi@0 | 27 | # This jdk must be hopper or better; it must have the |
aoqi@0 | 28 | # SA connectors in VirtualMachineManagerImpl. |
aoqi@0 | 29 | jdk=/java/re/jdk/1.4.1/promoted/latest/binaries/solaris-sparc |
aoqi@0 | 30 | #jdk=/net/mmm/export/mmm/jdk1.4fcs.sa |
aoqi@0 | 31 | |
aoqi@0 | 32 | doUsage() |
aoqi@0 | 33 | { |
aoqi@0 | 34 | cat <<EOF |
aoqi@0 | 35 | Run sagclient.class using Serviceability Agent to talk to a corefile/pid/debugserver. |
aoqi@0 | 36 | Usage: runsa.sh [-jdk <jdk-pathname>] [-jdb] [ -jdbx ] [ -d64 ] [ -remote ] [ pid | corefile | debugserver ] |
aoqi@0 | 37 | |
aoqi@0 | 38 | -jdk means to use that jdk. Default is 1.4.1/latest. |
aoqi@0 | 39 | -jdbx means to run it under jdbx |
aoqi@0 | 40 | -jdb means to connect using jdb instead of the sagclient program. |
aoqi@0 | 41 | -remote debugserver means you want to connect to a remote debug server |
aoqi@0 | 42 | |
aoqi@0 | 43 | The corefile must have been produced by the same java as is running SA. |
aoqi@0 | 44 | |
aoqi@0 | 45 | EOF |
aoqi@0 | 46 | } |
aoqi@0 | 47 | |
aoqi@0 | 48 | if [ $# = 0 ] ; then |
aoqi@0 | 49 | doUsage |
aoqi@0 | 50 | exit 1 |
aoqi@0 | 51 | fi |
aoqi@0 | 52 | |
aoqi@0 | 53 | # License file for development version of dbx |
aoqi@0 | 54 | #LM_LICENSE_FILE=7588@extend.eng:/usr/dist/local/config/sparcworks/license.dat:7588@setlicense |
aoqi@0 | 55 | #export LM_LICENSE_FILE |
aoqi@0 | 56 | |
aoqi@0 | 57 | do= |
aoqi@0 | 58 | args= |
aoqi@0 | 59 | theClass=sagclient |
aoqi@0 | 60 | javaArgs= |
aoqi@0 | 61 | |
aoqi@0 | 62 | while [ $# != 0 ] ; do |
aoqi@0 | 63 | case $1 in |
aoqi@0 | 64 | -vv) |
aoqi@0 | 65 | set -x |
aoqi@0 | 66 | ;; |
aoqi@0 | 67 | -jdk) |
aoqi@0 | 68 | jdk=$2 |
aoqi@0 | 69 | shift |
aoqi@0 | 70 | ;; |
aoqi@0 | 71 | -jdbx) |
aoqi@0 | 72 | do=jdbx |
aoqi@0 | 73 | ;; |
aoqi@0 | 74 | -jdb) |
aoqi@0 | 75 | do=jdb |
aoqi@0 | 76 | ;; |
aoqi@0 | 77 | -help | help) |
aoqi@0 | 78 | doUsage |
aoqi@0 | 79 | exit |
aoqi@0 | 80 | ;; |
aoqi@0 | 81 | -d64) |
aoqi@0 | 82 | d64=-d64 |
aoqi@0 | 83 | ;; |
aoqi@0 | 84 | -remote) |
aoqi@0 | 85 | shift |
aoqi@0 | 86 | args="$1" |
aoqi@0 | 87 | do=remote |
aoqi@0 | 88 | ;; |
aoqi@0 | 89 | -*) |
aoqi@0 | 90 | javaArgs="$javaArgs $1" |
aoqi@0 | 91 | ;; |
aoqi@0 | 92 | *) |
aoqi@0 | 93 | echo "$1" | grep -s '^[0-9]*$' > /dev/null |
aoqi@0 | 94 | if [ $? = 0 ] ; then |
aoqi@0 | 95 | # it is a pid |
aoqi@0 | 96 | args="$args $1" |
aoqi@0 | 97 | else |
aoqi@0 | 98 | # It is a core. |
aoqi@0 | 99 | # We have to pass the name of the program that produced the |
aoqi@0 | 100 | # core, and the core file itself. |
aoqi@0 | 101 | args="$jdk/bin/java $1" |
aoqi@0 | 102 | fi |
aoqi@0 | 103 | ;; |
aoqi@0 | 104 | esac |
aoqi@0 | 105 | shift |
aoqi@0 | 106 | done |
aoqi@0 | 107 | |
aoqi@0 | 108 | if [ -z "$jdk" ] ; then |
aoqi@0 | 109 | error "--Error: runsa.sh: Must specify -jdk <jdk-pathname>." |
aoqi@0 | 110 | error " Do runsa.sh -help for more info" |
aoqi@0 | 111 | exit 1 |
aoqi@0 | 112 | fi |
aoqi@0 | 113 | |
aoqi@0 | 114 | set -x |
aoqi@0 | 115 | |
aoqi@0 | 116 | # If jjh makes this, then the classes are in .../build/agent. |
aoqi@0 | 117 | # if someone else does, they are in . |
aoqi@0 | 118 | classesDir=../../../../../../build/agent |
aoqi@0 | 119 | if [ ! -r $classesDir ] ; then |
aoqi@0 | 120 | classesDir=. |
aoqi@0 | 121 | if [ ! -r $classesDir ] ; then |
aoqi@0 | 122 | echo "-- Error: runsa.sh can't find the SA classes" |
aoqi@0 | 123 | exit 1 |
aoqi@0 | 124 | fi |
aoqi@0 | 125 | fi |
aoqi@0 | 126 | #javacp="/net/mmm/export/mmm/ws/sabaseline/build/solaris/solaris_sparc_compiler1/generated/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir" |
aoqi@0 | 127 | |
aoqi@0 | 128 | javacp="$jdk/lib/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir" |
aoqi@0 | 129 | |
aoqi@0 | 130 | |
aoqi@0 | 131 | extraArgs="-showversion $javaArgs" |
aoqi@0 | 132 | #extraArgs="-DdbxSvcAgentDSOPathName=/net/mmm/export/mmm/ws/m/b2/sa/src/os/solaris/agent/64bit/libsvc_agent_dbx.so $extraArgs" |
aoqi@0 | 133 | #extraArgs="-DdbxSvcAgentDSOPathName=/net/jano.eng/export/disk05/hotspot/sa/solaris/sparcv9/lib/libsvc_agent_dbx.so $extraArgs" |
aoqi@0 | 134 | |
aoqi@0 | 135 | mkdir -p workdir |
aoqi@0 | 136 | if [ sagclient.java -nt ./workdir/sagclient.class ] ; then |
aoqi@0 | 137 | $jdk/bin/javac -d ./workdir -classpath $javacp sagclient.java |
aoqi@0 | 138 | if [ $? != 0 ] ; then |
aoqi@0 | 139 | exit 1 |
aoqi@0 | 140 | fi |
aoqi@0 | 141 | fi |
aoqi@0 | 142 | if [ sagdoit.java -nt ./workdir/sagdoit.class ] ; then |
aoqi@0 | 143 | $jdk/bin/javac -d ./workdir -classpath $javacp sagdoit.java |
aoqi@0 | 144 | if [ $? != 0 ] ; then |
aoqi@0 | 145 | exit 1 |
aoqi@0 | 146 | fi |
aoqi@0 | 147 | fi |
aoqi@0 | 148 | |
aoqi@0 | 149 | if [ "$do" = jdbx ] ; then |
aoqi@0 | 150 | set -x |
aoqi@0 | 151 | dbx=/net/sparcworks.eng/export/set/sparcworks2/dbx_70_nightly/dev/buildbin/Derived-sparc-S2-opt/bin/dbx |
aoqi@0 | 152 | |
aoqi@0 | 153 | # Have to do this export for jdbx to work. -cp and -classpath don't work. |
aoqi@0 | 154 | CLASSPATH=$javacp |
aoqi@0 | 155 | export CLASSPATH |
aoqi@0 | 156 | #extraArgs="-Djava.class.path=$mhs/../sa/build/agent sun.jvm.hotspot.HSDB $*" |
aoqi@0 | 157 | jvm_invocation="$jdk/bin/java -Xdebug \ |
aoqi@0 | 158 | -Dsun.boot.class.path=$jdk/classes \ |
aoqi@0 | 159 | $extraArgs" |
aoqi@0 | 160 | #export jvm_invocation |
aoqi@0 | 161 | |
aoqi@0 | 162 | JAVASRCPATH=$mhs/../sa/src/share/vm/agent |
aoqi@0 | 163 | export JAVASRCPATH |
aoqi@0 | 164 | |
aoqi@0 | 165 | #operand is pathname of .class file, eg ./jj.class. |
aoqi@0 | 166 | echo run $args |
aoqi@0 | 167 | clss=`echo $theClass | sed -e 's@\.@/@'` |
aoqi@0 | 168 | if [ -r ./workdir/$clss.class ] ; then |
aoqi@0 | 169 | # kludge for running sagclient |
aoqi@0 | 170 | $dbx ./workdir/$clss.class |
aoqi@0 | 171 | else |
aoqi@0 | 172 | # kludge for running HSDB |
aoqi@0 | 173 | $dbx $mhs/../sa/build/agent/$clss.class |
aoqi@0 | 174 | fi |
aoqi@0 | 175 | elif [ "$do" = jdb ] ; then |
aoqi@0 | 176 | # This hasn't been tested. |
aoqi@0 | 177 | $jdk/bin/jdb -J-Xbootclasspath/a:$classesDir -connect sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=sagcore |
aoqi@0 | 178 | elif [ "$do" = remote ] ; then |
aoqi@0 | 179 | $jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args |
aoqi@0 | 180 | else |
aoqi@0 | 181 | $jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args |
aoqi@0 | 182 | |
aoqi@0 | 183 | fi |