2
|
1 |
#!/bin/sh
|
|
2 |
|
|
3 |
#
|
|
4 |
# Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved.
|
|
5 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
6 |
#
|
|
7 |
# This code is free software; you can redistribute it and/or modify it
|
|
8 |
# under the terms of the GNU General Public License version 2 only, as
|
|
9 |
# published by the Free Software Foundation.
|
|
10 |
#
|
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
# accompanied this code).
|
|
16 |
#
|
|
17 |
# You should have received a copy of the GNU General Public License version
|
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
#
|
|
21 |
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
# CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
# have any questions.
|
|
24 |
#
|
|
25 |
|
|
26 |
# @test
|
|
27 |
# @bug 4622663
|
|
28 |
# @summary redefine and pop top frame from jdb gets assertion failure
|
|
29 |
# @author Jim Holmlund/Swamy Venkataramanappa
|
|
30 |
#
|
|
31 |
# The failure occurs with debug java when the pop deletes the
|
|
32 |
# line that called the method which is being popped.
|
|
33 |
# @run shell RedefinePop.sh
|
|
34 |
|
|
35 |
|
|
36 |
# assert(index<len, "should have found method")
|
|
37 |
# [8] report_assertion_failure(0xfe2a54d9, 0xfe2a54e3, 0x2cc, 0xfe2a5527, 0xfffffff8, 0x3f2b8), at 0xfda1e5e8
|
|
38 |
# [9] methodOopDesc::jni_id(0xf590a2f0, 0x3e868, 0x8, 0xffbed760, 0xf590a3ac, 0xffbed664), at 0xfdcd7a2c
|
|
39 |
# [10] JvmdiThreadState::compare_and_set_current_location(0x3f450, 0xf590a2f0, 0xf590a33f, 0x1, 0x1, 0x3e868), at 0xfdc0f670
|
|
40 |
# [11] jvmdi::at_single_stepping_point(0x3e868, 0xf590a2f0, 0xf590a33f, 0x5, 0x0, 0x0), at 0xfdc29184
|
|
41 |
# [12] InterpreterRuntime::at_safepoint(0x3e868, 0xb6, 0x2, 0xf9c28744, 0xf590a038, 0xffbed880), at 0xfdb0d590
|
|
42 |
|
|
43 |
# These are variables that can be set to control execution
|
|
44 |
|
|
45 |
compileOptions=-g
|
|
46 |
|
|
47 |
createJavaFile()
|
|
48 |
{
|
|
49 |
cat <<EOF > $1.java.1
|
|
50 |
|
|
51 |
public class $1 {
|
|
52 |
static public void main(String[] args) {
|
|
53 |
$1 mine = new $1();
|
|
54 |
mine.a1(44); // @1 delete the call that we are in when the pop occurs
|
|
55 |
mine.a4();
|
|
56 |
}
|
|
57 |
|
|
58 |
public void a1(int p1) {
|
|
59 |
System.out.println("a1: @1 breakpoint here");
|
|
60 |
}
|
|
61 |
|
|
62 |
public void a4() {
|
|
63 |
System.out.println("a4: The next line should not say Ni!");
|
|
64 |
System.out.println("a4: Ni!"); // @1 delete
|
|
65 |
}
|
|
66 |
}
|
|
67 |
EOF
|
|
68 |
}
|
|
69 |
|
|
70 |
# This is called to feed cmds to jdb.
|
|
71 |
dojdbCmds()
|
|
72 |
{
|
|
73 |
setBkpts @1
|
|
74 |
runToBkpt @1
|
|
75 |
redefineClass @1
|
|
76 |
cmd pop
|
|
77 |
cmd cont
|
|
78 |
cmd quit
|
|
79 |
}
|
|
80 |
|
|
81 |
|
|
82 |
mysetup()
|
|
83 |
{
|
|
84 |
if [ -z "$TESTSRC" ] ; then
|
|
85 |
TESTSRC=.
|
|
86 |
fi
|
|
87 |
|
|
88 |
for ii in . $TESTSRC $TESTSRC/.. ; do
|
|
89 |
if [ -r "$ii/ShellScaffold.sh" ] ; then
|
|
90 |
. $ii/ShellScaffold.sh
|
|
91 |
break
|
|
92 |
fi
|
|
93 |
done
|
|
94 |
}
|
|
95 |
|
|
96 |
# You could replace this next line with the contents
|
|
97 |
# of ShellScaffold.sh and this script will run just the same.
|
|
98 |
mysetup
|
|
99 |
|
|
100 |
runit
|
|
101 |
debuggeeFailIfPresent "Internal exception:"
|
|
102 |
pass
|