Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/agent/test/jdi/runjpda.sh
38764 views
#!/bin/ksh1#2# Copyright (c) 2002, 2004, 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#2425# This script runs the test program, sagtest.java, with the regular26# JPDA jdi.27# It then starts up the debuggee part of the test, sagtarg.java,28# and calls gcore to create file sagcore for use in running29# the SA JDI client.3031set -x32# jdk is a jdk with the vm from the sa workspace33while [ $# != 0 ] ; do34case $1 in35-vv)36set -x37;;38-gui)39theClass=sun.jvm.hotspot.HSDB40;;41-jdk)42jdk=$243shift44;;45-jdbx)46do=jdbx47;;48-jdb)49do=jdb50;;51-help | help)52doUsage53exit54;;55-dontkill)56dontkill=true57;;58-d64)59d64=-d6460;;61-*)62javaArgs="$javaArgs $1"63;;64*)65echo "$1" | grep -s '^[0-9]*$' > /dev/null66if [ $? = 0 ] ; then67# it is a pid68args="$args $1"69else70# It is a core.71# We have to pass the name of the program that produced the72# core, and the core file itself.73args="$jdk/bin/java $1"74fi75;;76esac77shift78done7980# First, run the sagtest.java with the regular JPDA jdi81workdir=./workdir82mkdir -p $workdir83CLASSPATH=$jdk/classes:$jdk/lib/tools.jar:$workdir84export CLASSPATH8586$jdk/bin/javac -g -source 1.5 -classpath $jdk/classes:$jdk/lib/tools.jar:$workdir -J-Xms40m -d $workdir \87TestScaffold.java \88VMConnection.java \89TargetListener.java \90TargetAdapter.java \91sagdoit.java \92sagtarg.java \93sagtest.java9495if [ $? != 0 ] ; then96exit 197fi9899$jdk/bin/java $javaArgs -Dtest.classes=$workdir sagtest100101# Now run create a core file for use in running sa-jdi102103if [ ! core.satest -nt sagtarg.class ] ; then104tmp=/tmp/sagsetup105rm -f $tmp106$jdk/bin/java $d64 sagtarg > $tmp &107pid=$!108while [ ! -s $tmp ] ; do109# Kludge alert!110sleep 2111done112#rm -f $tmp113114# force core dump of the debuggee115OS=`uname`116if [ "$OS" = "Linux" ]; then117# Linux does not have gcore command. Instead, we use 'gdb's118# gcore command. Note that only some versions of gdb support119# gdb command.120echo "gcore" > gdbscript121gdb -batch -p $pid -x gdbscript122rm -f gdbscript123else124gcore $* $pid125fi126mv core.$pid sagcore127128if [ "$dontkill" != "true" ]; then129kill -9 $pid130fi131fi132133134135