author | alexsch |
Thu, 31 Jul 2014 14:28:10 +0400 | |
changeset 26019 | 10a56d28f48d |
parent 24973 | 8c4bc3fa4c4e |
child 30376 | 2ccf2cf7ea48 |
permissions | -rw-r--r-- |
21287
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
1 |
/* |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
4 |
* |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
8 |
* |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
13 |
* accompanied this code). |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
14 |
* |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
18 |
* |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
21 |
* questions. |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
22 |
*/ |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
23 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
24 |
/** |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
25 |
* @test |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
26 |
* @bug 8021897 |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
27 |
* @summary Test getting the value for an uninitialized String object |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
28 |
* |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
29 |
* @author Staffan Larsen |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
30 |
* |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
31 |
* @run build TestScaffold VMConnection TargetListener TargetAdapter |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
32 |
* @run compile -g GetUninitializedStringValue.java |
24973
8c4bc3fa4c4e
6622468: TEST_BUG: Time to retire the @debuggeeVMOptions mechanism used in the com.sun.jdi infrastructure
sla
parents:
21287
diff
changeset
|
33 |
* @run driver GetUninitializedStringValue |
21287
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
34 |
*/ |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
35 |
import com.sun.jdi.ReferenceType; |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
36 |
import com.sun.jdi.StackFrame; |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
37 |
import com.sun.jdi.StringReference; |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
38 |
import com.sun.jdi.ThreadReference; |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
39 |
import com.sun.jdi.event.BreakpointEvent; |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
40 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
41 |
/********** target program **********/ |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
42 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
43 |
class GetUninitializedStringValueTarg { |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
44 |
public static void main(String[] args) { |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
45 |
new String("foo"); |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
46 |
System.out.println("Goodbye from GetUninitializedStringValueTarg!"); |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
47 |
} |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
48 |
} |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
49 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
50 |
/********** test program **********/ |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
51 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
52 |
public class GetUninitializedStringValue extends TestScaffold { |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
53 |
ReferenceType targetClass; |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
54 |
ThreadReference mainThread; |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
55 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
56 |
GetUninitializedStringValue (String args[]) { |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
57 |
super(args); |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
58 |
} |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
59 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
60 |
public static void main(String[] args) |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
61 |
throws Exception |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
62 |
{ |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
63 |
new GetUninitializedStringValue (args).startTests(); |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
64 |
} |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
65 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
66 |
/********** test core **********/ |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
67 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
68 |
protected void runTests() |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
69 |
throws Exception |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
70 |
{ |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
71 |
/* |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
72 |
* Run to String.<init> |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
73 |
*/ |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
74 |
startUp("GetUninitializedStringValueTarg"); |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
75 |
BreakpointEvent bpe = resumeTo("java.lang.String", "<init>", "(Ljava/lang/String;)V"); |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
76 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
77 |
/* |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
78 |
* We've arrived. Look at 'this' - it will be uninitialized (the value field will not be set yet). |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
79 |
*/ |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
80 |
StackFrame frame = bpe.thread().frame(0); |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
81 |
StringReference sr = (StringReference)frame.thisObject(); |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
82 |
if (!sr.value().equals("")) { |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
83 |
throw new Exception("Unexpected value for the uninitialized String"); |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
84 |
} |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
85 |
|
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
86 |
/* |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
87 |
* resume the target listening for events |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
88 |
*/ |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
89 |
listenUntilVMDisconnect(); |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
90 |
} |
6992b904917c
8021897: EXCEPTION_ACCESS_VIOLATION on debugging String.contentEquals()
sla
parents:
diff
changeset
|
91 |
} |