Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/agent/test/jdi/runsa.sh
38764 views
#!/bin/ksh1#2# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4#5# This code is free software; you can redistribute it and/or modify it6# under the terms of the GNU General Public License version 2 only, as7# published by the Free Software Foundation.8#9# This code is distributed in the hope that it will be useful, but WITHOUT10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12# version 2 for more details (a copy is included in the LICENSE file that13# accompanied this code).14#15# You should have received a copy of the GNU General Public License version16# 2 along with this work; if not, write to the Free Software Foundation,17# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18#19# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20# or visit www.oracle.com if you need additional information or have any21# questions.22#23#242526# This jdk must be hopper or better; it must have the27# SA connectors in VirtualMachineManagerImpl.28jdk=/java/re/jdk/1.4.1/promoted/latest/binaries/solaris-sparc29#jdk=/net/mmm/export/mmm/jdk1.4fcs.sa3031doUsage()32{33cat <<EOF34Run sagclient.class using Serviceability Agent to talk to a corefile/pid/debugserver.35Usage: runsa.sh [-jdk <jdk-pathname>] [-jdb] [ -jdbx ] [ -d64 ] [ -remote ] [ pid | corefile | debugserver ]3637-jdk means to use that jdk. Default is 1.4.1/latest.38-jdbx means to run it under jdbx39-jdb means to connect using jdb instead of the sagclient program.40-remote debugserver means you want to connect to a remote debug server4142The corefile must have been produced by the same java as is running SA.4344EOF45}4647if [ $# = 0 ] ; then48doUsage49exit 150fi5152# License file for development version of dbx53#[email protected]:/usr/dist/local/config/sparcworks/license.dat:7588@setlicense54#export LM_LICENSE_FILE5556do=57args=58theClass=sagclient59javaArgs=6061while [ $# != 0 ] ; do62case $1 in63-vv)64set -x65;;66-jdk)67jdk=$268shift69;;70-jdbx)71do=jdbx72;;73-jdb)74do=jdb75;;76-help | help)77doUsage78exit79;;80-d64)81d64=-d6482;;83-remote)84shift85args="$1"86do=remote87;;88-*)89javaArgs="$javaArgs $1"90;;91*)92echo "$1" | grep -s '^[0-9]*$' > /dev/null93if [ $? = 0 ] ; then94# it is a pid95args="$args $1"96else97# It is a core.98# We have to pass the name of the program that produced the99# core, and the core file itself.100args="$jdk/bin/java $1"101fi102;;103esac104shift105done106107if [ -z "$jdk" ] ; then108error "--Error: runsa.sh: Must specify -jdk <jdk-pathname>."109error " Do runsa.sh -help for more info"110exit 1111fi112113set -x114115# If jjh makes this, then the classes are in .../build/agent.116# if someone else does, they are in .117classesDir=../../../../../../build/agent118if [ ! -r $classesDir ] ; then119classesDir=.120if [ ! -r $classesDir ] ; then121echo "-- Error: runsa.sh can't find the SA classes"122exit 1123fi124fi125#javacp="/net/mmm/export/mmm/ws/sabaseline/build/solaris/solaris_sparc_compiler1/generated/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir"126127javacp="$jdk/lib/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir"128129130extraArgs="-showversion $javaArgs"131#extraArgs="-DdbxSvcAgentDSOPathName=/net/mmm/export/mmm/ws/m/b2/sa/src/os/solaris/agent/64bit/libsvc_agent_dbx.so $extraArgs"132#extraArgs="-DdbxSvcAgentDSOPathName=/net/jano.eng/export/disk05/hotspot/sa/solaris/sparcv9/lib/libsvc_agent_dbx.so $extraArgs"133134mkdir -p workdir135if [ sagclient.java -nt ./workdir/sagclient.class ] ; then136$jdk/bin/javac -d ./workdir -classpath $javacp sagclient.java137if [ $? != 0 ] ; then138exit 1139fi140fi141if [ sagdoit.java -nt ./workdir/sagdoit.class ] ; then142$jdk/bin/javac -d ./workdir -classpath $javacp sagdoit.java143if [ $? != 0 ] ; then144exit 1145fi146fi147148if [ "$do" = jdbx ] ; then149set -x150dbx=/net/sparcworks.eng/export/set/sparcworks2/dbx_70_nightly/dev/buildbin/Derived-sparc-S2-opt/bin/dbx151152# Have to do this export for jdbx to work. -cp and -classpath don't work.153CLASSPATH=$javacp154export CLASSPATH155#extraArgs="-Djava.class.path=$mhs/../sa/build/agent sun.jvm.hotspot.HSDB $*"156jvm_invocation="$jdk/bin/java -Xdebug \157-Dsun.boot.class.path=$jdk/classes \158$extraArgs"159#export jvm_invocation160161JAVASRCPATH=$mhs/../sa/src/share/vm/agent162export JAVASRCPATH163164#operand is pathname of .class file, eg ./jj.class.165echo run $args166clss=`echo $theClass | sed -e 's@\.@/@'`167if [ -r ./workdir/$clss.class ] ; then168# kludge for running sagclient169$dbx ./workdir/$clss.class170else171# kludge for running HSDB172$dbx $mhs/../sa/build/agent/$clss.class173fi174elif [ "$do" = jdb ] ; then175# This hasn't been tested.176$jdk/bin/jdb -J-Xbootclasspath/a:$classesDir -connect sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=sagcore177elif [ "$do" = remote ] ; then178$jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args179else180$jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args181182fi183184185