Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java
41161 views
1
/*
2
* Copyright (c) 2001, 2018, 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
package nsk.jdi.EventSet.resume;
25
26
import nsk.share.*;
27
import nsk.share.jpda.*;
28
import nsk.share.jdi.*;
29
30
/**
31
* This class is used as debuggee application for the resume001 JDI test.
32
*/
33
34
public class resume001a {
35
36
//----------------------------------------------------- template section
37
38
static final int PASSED = 0;
39
static final int FAILED = 2;
40
static final int PASS_BASE = 95;
41
42
static ArgumentHandler argHandler;
43
static Log log;
44
45
//-------------------------------------------------- log procedures
46
47
static void log1(String message) {
48
log.display("**> debuggee: " + message);
49
}
50
51
private static void logErr(String message) {
52
log.complain("**> debuggee: " + message);
53
}
54
55
//====================================================== test program
56
//------------------------------------------------------ common section
57
58
static int exitCode = PASSED;
59
60
static int testCase = -1;
61
static int instruction = 1;
62
static int end = 0;
63
// static int quit = 0;
64
// static int continue = 2;
65
static int maxInstr = 1; // 2;
66
67
static int lineForComm = 2;
68
69
private static void methodForCommunication() {
70
int i1 = instruction;
71
int i2 = i1;
72
int i3 = i2;
73
}
74
//---------------------------------------------------- main method
75
76
public static void main (String argv[]) {
77
78
argHandler = new ArgumentHandler(argv);
79
log = argHandler.createDebugeeLog();
80
81
log1("debuggee started!");
82
83
84
label0:
85
for (int i = 0; ; i++) {
86
87
log1("methodForCommunication();");
88
methodForCommunication();
89
if (instruction == end)
90
break;
91
92
if (instruction > maxInstr) {
93
logErr("ERROR: unexpected instruction: " + instruction);
94
exitCode = FAILED;
95
break ;
96
}
97
98
switch (i) {
99
100
//------------------------------------------------------ section tested
101
102
case 0:
103
TestClass2 obj2 = new TestClass2();
104
// Wait for debugger to complete the first test case
105
// before advancing to the first breakpoint
106
waitForTestCase(0);
107
108
break;
109
110
case 1:
111
TestClass3 obj3 = new TestClass3();
112
break;
113
114
case 2:
115
TestClass4 obj4 = new TestClass4();
116
//------------------------------------------------- standard end section
117
118
default:
119
instruction = end;
120
break label0;
121
}
122
}
123
124
log1("debuggee exits");
125
System.exit(exitCode + PASS_BASE);
126
}
127
// Synchronize with debugger progression.
128
static void waitForTestCase(int t) {
129
while (testCase < t) {
130
try {
131
Thread.sleep(100);
132
} catch (InterruptedException e) {
133
// ignored
134
}
135
}
136
}
137
}
138
139
class TestClass2 {
140
static int var1 = 0;
141
}
142
143
class TestClass3 {
144
static int var1 = 0;
145
}
146
147
class TestClass4 {
148
static int var1 = 0;
149
}
150
151