Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/agent/test/jdi/runsa.sh
38764 views
1
#!/bin/ksh
2
#
3
# Copyright (c) 2002, 2012, 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.
29
jdk=/java/re/jdk/1.4.1/promoted/latest/binaries/solaris-sparc
30
#jdk=/net/mmm/export/mmm/jdk1.4fcs.sa
31
32
doUsage()
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
45
EOF
46
}
47
48
if [ $# = 0 ] ; then
49
doUsage
50
exit 1
51
fi
52
53
# License file for development version of dbx
54
#[email protected]:/usr/dist/local/config/sparcworks/license.dat:7588@setlicense
55
#export LM_LICENSE_FILE
56
57
do=
58
args=
59
theClass=sagclient
60
javaArgs=
61
62
while [ $# != 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
106
done
107
108
if [ -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
112
fi
113
114
set -x
115
116
# If jjh makes this, then the classes are in .../build/agent.
117
# if someone else does, they are in .
118
classesDir=../../../../../../build/agent
119
if [ ! -r $classesDir ] ; then
120
classesDir=.
121
if [ ! -r $classesDir ] ; then
122
echo "-- Error: runsa.sh can't find the SA classes"
123
exit 1
124
fi
125
fi
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"
127
128
javacp="$jdk/lib/sa-jdi.jar:$classesDir:$jdk/lib/tools.jar:$jdk/classes:./workdir"
129
130
131
extraArgs="-showversion $javaArgs"
132
#extraArgs="-DdbxSvcAgentDSOPathName=/net/mmm/export/mmm/ws/m/b2/sa/src/os/solaris/agent/64bit/libsvc_agent_dbx.so $extraArgs"
133
#extraArgs="-DdbxSvcAgentDSOPathName=/net/jano.eng/export/disk05/hotspot/sa/solaris/sparcv9/lib/libsvc_agent_dbx.so $extraArgs"
134
135
mkdir -p workdir
136
if [ sagclient.java -nt ./workdir/sagclient.class ] ; then
137
$jdk/bin/javac -d ./workdir -classpath $javacp sagclient.java
138
if [ $? != 0 ] ; then
139
exit 1
140
fi
141
fi
142
if [ sagdoit.java -nt ./workdir/sagdoit.class ] ; then
143
$jdk/bin/javac -d ./workdir -classpath $javacp sagdoit.java
144
if [ $? != 0 ] ; then
145
exit 1
146
fi
147
fi
148
149
if [ "$do" = jdbx ] ; then
150
set -x
151
dbx=/net/sparcworks.eng/export/set/sparcworks2/dbx_70_nightly/dev/buildbin/Derived-sparc-S2-opt/bin/dbx
152
153
# Have to do this export for jdbx to work. -cp and -classpath don't work.
154
CLASSPATH=$javacp
155
export CLASSPATH
156
#extraArgs="-Djava.class.path=$mhs/../sa/build/agent sun.jvm.hotspot.HSDB $*"
157
jvm_invocation="$jdk/bin/java -Xdebug \
158
-Dsun.boot.class.path=$jdk/classes \
159
$extraArgs"
160
#export jvm_invocation
161
162
JAVASRCPATH=$mhs/../sa/src/share/vm/agent
163
export JAVASRCPATH
164
165
#operand is pathname of .class file, eg ./jj.class.
166
echo run $args
167
clss=`echo $theClass | sed -e 's@\.@/@'`
168
if [ -r ./workdir/$clss.class ] ; then
169
# kludge for running sagclient
170
$dbx ./workdir/$clss.class
171
else
172
# kludge for running HSDB
173
$dbx $mhs/../sa/build/agent/$clss.class
174
fi
175
elif [ "$do" = jdb ] ; then
176
# This hasn't been tested.
177
$jdk/bin/jdb -J-Xbootclasspath/a:$classesDir -connect sun.jvm.hotspot.jdi.SACoreAttachingConnector:core=sagcore
178
elif [ "$do" = remote ] ; then
179
$jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args
180
else
181
$jdk/bin/java $d64 -Djava.class.path=$javacp $extraArgs $theClass $args
182
183
fi
184
185