Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/regression/b4689395/b4689395.java
40951 views
1
/*
2
* Copyright (c) 2002, 2020, 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 it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 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 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
25
/*
26
* @test
27
*
28
* @bug 4689395
29
* @summary converted from VM Testbase nsk/jdb/regression/b4689395.
30
* VM Testbase keywords: [jpda, jdb]
31
* VM Testbase readme:
32
* DESCRIPTION
33
* Regression test for the bug
34
* 4689395 (P4/S3) "step over" after a class is redefined acts like "step out"
35
* Release summary: 1.4
36
* Hardware version: generic
37
* O/S version (unbundled products): 5.8
38
* The test consists of two java-files:
39
* b4689395.java - launches jdb and debuggee, writes commands to jdb,
40
* reads the jdb output;
41
* b4689395a.java - the debugged application.
42
* The debugged application (b4689395a.java) defines method minor() that
43
* prints four lines into System.out. b4689395 sets a breakpoint on the 54th
44
* line
45
* System.out.println("A breakpoint is here.");
46
* and then redefines b4689395a with newclass/b4689395a. Those classes differ
47
* just in the 30th line (period is omitted in newclass/b4689395a). After that
48
* the debuggee invokes 'next' command. The test fails if
49
* b4689395.ERROR_MESSAGE message appears in output, otherwise the test passes.
50
* COMMENTS
51
* The test reproduces the bug on Solsparc.
52
* java version "1.4.1-beta"
53
* Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
54
* Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)
55
* Command line
56
* ../jdk1.4.1-b14/solsparc/bin/java b4689395 -arch=sparc
57
* -waittime=2 -debugee.vmkind=java
58
* -jdb=../jdk1.4.1-b14/solsparc/bin/jdb
59
* -workdir=../b4689395 -jdb.option= -debugee.vmkeys=
60
* #launcher > Compound prompt found: main[1]
61
* #Test cases starts.
62
* #Sending command: stop at b4689395a:54
63
* #
64
* #launcher > Compound prompt found: main[1]
65
* #Sending command: cont
66
* #
67
* #launcher > Compound prompt found: main[1]
68
* #Sending command: redefine b4689395a b4689395/newclass/b4689395a.class
69
* #
70
* #launcher > Compound prompt found: main[1]
71
* #Sending command: next
72
* #
73
* #launcher > Compound prompt found: main[1]
74
* ## ERROR: 'ERROR_M' is not expected to be printed after 'next' command.
75
* #Sending command: cont
76
* #
77
* #Test cases ends.
78
* #Waiting for jdb exits
79
* #jdb normally exited
80
* ## ERROR: TEST FAILED
81
* #
82
* #
83
* ##>
84
* ##> SUMMARY: Following errors occured
85
* ##> during test execution:
86
* ##>
87
* ## ERROR: 'ERROR_M' is not expected to be printed after 'next' command.
88
* ## ERROR: TEST FAILED
89
*
90
* @library /vmTestbase
91
* /test/lib
92
*
93
* @build nsk.jdb.regression.b4689395.b4689395
94
* nsk.jdb.regression.b4689395.b4689395a
95
*
96
* @comment compile newclass/b4689395a.java to newclass
97
* @run driver
98
* ExecDriver --cmd
99
* ${compile.jdk}/bin/javac
100
* -d ${test.classes}/newclass
101
* -cp ${test.class.path}
102
* ${test.src}/newclass/b4689395a.java
103
*
104
* @run main/othervm
105
* nsk.jdb.regression.b4689395.b4689395
106
* -arch=${os.family}-${os.simpleArch}
107
* -waittime=5
108
* -debugee.vmkind=java
109
* -transport.address=dynamic
110
* -jdb=${test.jdk}/bin/jdb
111
* -java.options="${test.vm.opts} ${test.java.opts}"
112
* -workdir=.
113
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
114
*/
115
116
package nsk.jdb.regression.b4689395;
117
118
import nsk.share.*;
119
import nsk.share.jdb.*;
120
import nsk.share.classload.ClassLoadUtils;
121
122
import java.io.*;
123
import java.util.*;
124
125
public class b4689395 extends JdbTest {
126
final static String TEST_CLASS = b4689395.class.getName();
127
final static String DEBUGGEE_CLASS = TEST_CLASS + "a";
128
final static String FIRST_BREAK = DEBUGGEE_CLASS + ".main";
129
final static String ERROR_MESSAGE = "ERROR_M";
130
final static int LINE_NUMBER = 54;
131
private String classFile;
132
133
public static void main (String argv[]) {
134
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
135
}
136
137
public static int run(String argv[], PrintStream out) {
138
debuggeeClass = DEBUGGEE_CLASS;
139
firstBreak = FIRST_BREAK;
140
return new b4689395().runTest(argv, out);
141
}
142
143
public b4689395() {
144
classFile = ClassLoadUtils.getRedefineClassFileName(DEBUGGEE_CLASS);
145
if (classFile == null)
146
throw new TestFailure("Unable to find redefine class file in classpath for: " + DEBUGGEE_CLASS);
147
}
148
149
protected void runCases() {
150
String[] reply;
151
reply = jdb.receiveReplyFor(JdbCommand.stop_at + DEBUGGEE_CLASS + ":" + LINE_NUMBER);
152
reply = jdb.receiveReplyFor(JdbCommand.cont);
153
154
if (new File(classFile).exists()) {
155
reply = jdb.receiveReplyFor(JdbCommand.redefine + DEBUGGEE_CLASS
156
+ " " + classFile);
157
reply = jdb.receiveReplyFor(JdbCommand.next);
158
159
Paragrep grep = new Paragrep(reply);
160
if (grep.find(ERROR_MESSAGE) != 0) {
161
log.complain("'" + ERROR_MESSAGE + "' is not expected to be "
162
+ "printed after 'next' command.");
163
success = false;
164
}
165
} else {
166
log.complain("File does not exist: " + classFile);
167
success = false;
168
}
169
170
jdb.contToExit(1);
171
}
172
}
173
174