source: trunk/openjdk/hotspot/agent/test/jdi/runsa.sh

Last change on this file was 278, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b22 from branches/vendor/oracle.

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