hotspot/agent/test/jdi/runjpda.sh
author serb
Wed, 04 Jun 2014 16:55:06 +0400
changeset 25127 e92fa066b0e0
parent 5547 f4b087cbb361
permissions -rw-r--r--
8041129: [OGL] surface->sw blit is extremely slow 8017626: [OGL] Translucent VolatileImages don't paint correctly Reviewed-by: bae, flar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
#!/bin/ksh
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
#
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
     3
# Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
#
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
# published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
#
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
# This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
# version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
# accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
#
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
# You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
# 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
#
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
# or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    22
# questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
#  
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
#
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
# This script runs the test program, sagtest.java, with the regular
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
# JPDA jdi.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
# It then starts up the debuggee part of the test, sagtarg.java,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
# and calls gcore to create file sagcore for use in running
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
# the SA JDI client.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
set -x
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
# jdk is a jdk with the vm from the sa workspace
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
while [ $# != 0 ] ; do
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
    case $1 in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
      -vv)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
        set -x
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
        ;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
      -gui)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
        theClass=sun.jvm.hotspot.HSDB
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
        ;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
     -jdk)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
        jdk=$2
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
        shift
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
        ;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
     -jdbx)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
        do=jdbx
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
        ;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
     -jdb)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
        do=jdb
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
        ;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
     -help | help)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
        doUsage
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
        exit
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
        ;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
     -dontkill)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
        dontkill=true
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
        ;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
     -d64)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
        d64=-d64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
        ;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
     -*)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
        javaArgs="$javaArgs $1"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
        ;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
     *)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
        echo "$1" | grep -s '^[0-9]*$' > /dev/null
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
        if [ $? = 0 ] ; then
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
            # it is a pid
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
            args="$args $1"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
        else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
            # It is a core.        
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
            # We have to pass the name of the program that produced the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
            # core, and the core file itself.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
            args="$jdk/bin/java $1"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
        fi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
        ;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
   esac
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
   shift
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
done
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
# First, run the sagtest.java with the regular JPDA jdi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
workdir=./workdir
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
mkdir -p $workdir
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
CLASSPATH=$jdk/classes:$jdk/lib/tools.jar:$workdir
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
export CLASSPATH
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
$jdk/bin/javac -g  -source 1.5 -classpath $jdk/classes:$jdk/lib/tools.jar:$workdir -J-Xms40m -d $workdir \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    TestScaffold.java \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    VMConnection.java \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    TargetListener.java \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    TargetAdapter.java \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    sagdoit.java \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    sagtarg.java \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    sagtest.java
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
if [ $? != 0 ] ; then
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    exit 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
fi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
$jdk/bin/java $javaArgs -Dtest.classes=$workdir sagtest
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
# Now run create a core file for use in running sa-jdi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
if [ ! core.satest -nt sagtarg.class ] ; then
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    tmp=/tmp/sagsetup
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    rm -f $tmp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    $jdk/bin/java $d64 sagtarg > $tmp &
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    pid=$!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    while [ ! -s $tmp ] ; do
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
        # Kludge alert!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
        sleep 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    done
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    #rm -f $tmp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    # force core dump of the debuggee
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    OS=`uname`
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    if [ "$OS" = "Linux" ]; then
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
        # Linux does not have gcore command. Instead, we use 'gdb's
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
        # gcore command. Note that only some versions of gdb support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
        # gdb command.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
        echo "gcore" > gdbscript
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
        gdb -batch -p $pid -x gdbscript
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
        rm -f gdbscript
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
        gcore  $* $pid
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    fi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    mv core.$pid sagcore
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    if [ "$dontkill" != "true" ]; then
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
       kill -9 $pid
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    fi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
fi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133