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/runjpda.sh
38764 views
1
#!/bin/ksh
2
#
3
# Copyright (c) 2002, 2004, 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
# This script runs the test program, sagtest.java, with the regular
27
# JPDA jdi.
28
# It then starts up the debuggee part of the test, sagtarg.java,
29
# and calls gcore to create file sagcore for use in running
30
# the SA JDI client.
31
32
set -x
33
# jdk is a jdk with the vm from the sa workspace
34
while [ $# != 0 ] ; do
35
case $1 in
36
-vv)
37
set -x
38
;;
39
-gui)
40
theClass=sun.jvm.hotspot.HSDB
41
;;
42
-jdk)
43
jdk=$2
44
shift
45
;;
46
-jdbx)
47
do=jdbx
48
;;
49
-jdb)
50
do=jdb
51
;;
52
-help | help)
53
doUsage
54
exit
55
;;
56
-dontkill)
57
dontkill=true
58
;;
59
-d64)
60
d64=-d64
61
;;
62
-*)
63
javaArgs="$javaArgs $1"
64
;;
65
*)
66
echo "$1" | grep -s '^[0-9]*$' > /dev/null
67
if [ $? = 0 ] ; then
68
# it is a pid
69
args="$args $1"
70
else
71
# It is a core.
72
# We have to pass the name of the program that produced the
73
# core, and the core file itself.
74
args="$jdk/bin/java $1"
75
fi
76
;;
77
esac
78
shift
79
done
80
81
# First, run the sagtest.java with the regular JPDA jdi
82
workdir=./workdir
83
mkdir -p $workdir
84
CLASSPATH=$jdk/classes:$jdk/lib/tools.jar:$workdir
85
export CLASSPATH
86
87
$jdk/bin/javac -g -source 1.5 -classpath $jdk/classes:$jdk/lib/tools.jar:$workdir -J-Xms40m -d $workdir \
88
TestScaffold.java \
89
VMConnection.java \
90
TargetListener.java \
91
TargetAdapter.java \
92
sagdoit.java \
93
sagtarg.java \
94
sagtest.java
95
96
if [ $? != 0 ] ; then
97
exit 1
98
fi
99
100
$jdk/bin/java $javaArgs -Dtest.classes=$workdir sagtest
101
102
# Now run create a core file for use in running sa-jdi
103
104
if [ ! core.satest -nt sagtarg.class ] ; then
105
tmp=/tmp/sagsetup
106
rm -f $tmp
107
$jdk/bin/java $d64 sagtarg > $tmp &
108
pid=$!
109
while [ ! -s $tmp ] ; do
110
# Kludge alert!
111
sleep 2
112
done
113
#rm -f $tmp
114
115
# force core dump of the debuggee
116
OS=`uname`
117
if [ "$OS" = "Linux" ]; then
118
# Linux does not have gcore command. Instead, we use 'gdb's
119
# gcore command. Note that only some versions of gdb support
120
# gdb command.
121
echo "gcore" > gdbscript
122
gdb -batch -p $pid -x gdbscript
123
rm -f gdbscript
124
else
125
gcore $* $pid
126
fi
127
mv core.$pid sagcore
128
129
if [ "$dontkill" != "true" ]; then
130
kill -9 $pid
131
fi
132
fi
133
134
135