annotate agent/test/jdi/runjpda.sh @ 3237:399aa66d375e

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