duke@435: #!/bin/ksh duke@435: # duke@435: # Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved. duke@435: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: # duke@435: # This code is free software; you can redistribute it and/or modify it duke@435: # under the terms of the GNU General Public License version 2 only, as duke@435: # published by the Free Software Foundation. duke@435: # duke@435: # This code is distributed in the hope that it will be useful, but WITHOUT duke@435: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: # version 2 for more details (a copy is included in the LICENSE file that duke@435: # accompanied this code). duke@435: # duke@435: # You should have received a copy of the GNU General Public License version duke@435: # 2 along with this work; if not, write to the Free Software Foundation, duke@435: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: # duke@435: # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: # CA 95054 USA or visit www.sun.com if you need additional information or duke@435: # have any questions. duke@435: # duke@435: # duke@435: duke@435: duke@435: # This jdk must be hopper or better; it must have the duke@435: # SA connectors in VirtualMachineManagerImpl. duke@435: jdk=/java/re/jdk/1.4.1/promoted/latest/binaries/solaris-sparc duke@435: #jdk=/net/mmm/export/mmm/jdk1.4fcs.sa duke@435: duke@435: doUsage() duke@435: { duke@435: cat <] [-jdb] [ -jdbx ] [ -d64 ] [ -remote ] [ pid | corefile | debugserver ] duke@435: duke@435: -jdk means to use that jdk. Default is 1.4.1/latest. duke@435: -jdbx means to run it under jdbx duke@435: -jdb means to connect using jdb instead of the sagclient program. duke@435: -remote debugserver means you want to connect to a remote debug server duke@435: duke@435: The corefile must have been produced by the same java as is running SA. duke@435: duke@435: EOF duke@435: } duke@435: duke@435: if [ $# = 0 ] ; then duke@435: doUsage duke@435: exit 1 duke@435: fi duke@435: duke@435: # License file for development version of dbx duke@435: #LM_LICENSE_FILE=7588@extend.eng:/usr/dist/local/config/sparcworks/license.dat:7588@setlicense duke@435: #export LM_LICENSE_FILE duke@435: duke@435: do= duke@435: args= duke@435: theClass=sagclient duke@435: javaArgs= duke@435: duke@435: while [ $# != 0 ] ; do duke@435: case $1 in duke@435: -vv) duke@435: set -x duke@435: ;; duke@435: -jdk) duke@435: jdk=$2 duke@435: shift duke@435: ;; duke@435: -jdbx) duke@435: do=jdbx duke@435: ;; duke@435: -jdb) duke@435: do=jdb duke@435: ;; duke@435: -help | help) duke@435: doUsage duke@435: exit duke@435: ;; duke@435: -d64) duke@435: d64=-d64 duke@435: ;; duke@435: -remote) duke@435: shift duke@435: args="$1" duke@435: do=remote duke@435: ;; duke@435: -*) duke@435: javaArgs="$javaArgs $1" duke@435: ;; duke@435: *) duke@435: echo "$1" | grep -s '^[0-9]*$' > /dev/null duke@435: if [ $? = 0 ] ; then duke@435: # it is a pid duke@435: args="$args $1" duke@435: else duke@435: # It is a core. duke@435: # We have to pass the name of the program that produced the duke@435: # core, and the core file itself. duke@435: args="$jdk/bin/java $1" duke@435: fi duke@435: ;; duke@435: esac duke@435: shift duke@435: done duke@435: duke@435: if [ -z "$jdk" ] ; then duke@435: error "--Error: runsa.sh: Must specify -jdk ." duke@435: error " Do runsa.sh -help for more info" duke@435: exit 1 duke@435: fi duke@435: duke@435: set -x duke@435: #setenv USE_LIBPROC_DEBUGGER "-Dsun.jvm.hotspot.debugger.useProcDebugger -Djava.library.path=$saprocdir" duke@435: duke@435: # If jjh makes this, then the classes are in .../build/agent. duke@435: # if someone else does, they are in . duke@435: classesDir=../../../../../../build/agent duke@435: if [ ! -r $classesDir ] ; then duke@435: classesDir=. duke@435: if [ ! -r $classesDir ] ; then duke@435: echo "-- Error: runsa.sh can't find the SA classes" duke@435: exit 1 duke@435: fi duke@435: fi duke@435: #javacp="/net/mmm/export/mmm/ws/sabaseline/build/solaris/solaris_sparc_compiler1/generated/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir" duke@435: duke@435: javacp="$jdk/lib/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir" duke@435: duke@435: duke@435: extraArgs="-showversion $javaArgs" duke@435: #extraArgs="-DdbxSvcAgentDSOPathName=/net/mmm/export/mmm/ws/m/b2/sa/src/os/solaris/agent/64bit/libsvc_agent_dbx.so $extraArgs" duke@435: #extraArgs="-DdbxSvcAgentDSOPathName=/net/jano.eng/export/disk05/hotspot/sa/solaris/sparcv9/lib/libsvc_agent_dbx.so $extraArgs" duke@435: duke@435: mkdir -p workdir duke@435: if [ sagclient.java -nt ./workdir/sagclient.class ] ; then duke@435: $jdk/bin/javac -d ./workdir -classpath $javacp sagclient.java duke@435: if [ $? != 0 ] ; then duke@435: exit 1 duke@435: fi duke@435: fi duke@435: if [ sagdoit.java -nt ./workdir/sagdoit.class ] ; then duke@435: $jdk/bin/javac -d ./workdir -classpath $javacp sagdoit.java duke@435: if [ $? != 0 ] ; then duke@435: exit 1 duke@435: fi duke@435: fi duke@435: duke@435: if [ "$do" = jdbx ] ; then duke@435: set -x duke@435: dbx=/net/sparcworks.eng/export/set/sparcworks2/dbx_70_nightly/dev/buildbin/Derived-sparc-S2-opt/bin/dbx duke@435: duke@435: # Have to do this export for jdbx to work. -cp and -classpath don't work. duke@435: CLASSPATH=$javacp duke@435: export CLASSPATH duke@435: #extraArgs="-Djava.class.path=$mhs/../sa/build/agent sun.jvm.hotspot.HSDB $*" duke@435: jvm_invocation="$jdk/bin/java -Xdebug \ duke@435: -Dsun.boot.class.path=$jdk/classes \ duke@435: $extraArgs" duke@435: #export jvm_invocation duke@435: duke@435: JAVASRCPATH=$mhs/../sa/src/share/vm/agent duke@435: export JAVASRCPATH duke@435: duke@435: #operand is pathname of .class file, eg ./jj.class. duke@435: echo run $args duke@435: clss=`echo $theClass | sed -e 's@\.@/@'` duke@435: if [ -r ./workdir/$clss.class ] ; then duke@435: # kludge for running sagclient duke@435: $dbx ./workdir/$clss.class duke@435: else duke@435: # kludge for running HSDB duke@435: $dbx $mhs/../sa/build/agent/$clss.class duke@435: fi duke@435: elif [ "$do" = jdb ] ; then duke@435: # This hasn't been tested. duke@435: $jdk/bin/jdb -J-Xbootclasspath/a:$classesDir -connect sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=sagcore duke@435: elif [ "$do" = remote ] ; then duke@435: $jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args duke@435: else duke@435: $jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args duke@435: duke@435: fi