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/resume004a.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 resume004 JDI test.
32
*/
33
34
public class resume004a {
35
36
//----------------------------------------------------- template section
37
static int testCase = -1;
38
39
static final int PASSED = 0;
40
static final int FAILED = 2;
41
static final int PASS_BASE = 95;
42
43
static ArgumentHandler argHandler;
44
static Log log;
45
46
//-------------------------------------------------- log procedures
47
48
private static void log1(String message) {
49
log.display("**> debuggee: " + message);
50
}
51
52
private static void logErr(String message) {
53
log.complain("**> debuggee: " + message);
54
}
55
56
//====================================================== test program
57
58
static resume004aTestClass tcObject = new resume004aTestClass();
59
60
//------------------------------------------------------ common section
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
int exitCode = PASSED;
84
85
86
label0:
87
for (int i = 0; ; i++) {
88
89
if (instruction > maxInstr) {
90
logErr("ERROR: unexpected instruction: " + instruction);
91
exitCode = FAILED;
92
break ;
93
}
94
95
log1("methodForCommunication(); : " + i);
96
methodForCommunication();
97
98
switch (i) {
99
100
//------------------------------------------------------ section tested
101
102
case 0:
103
resume004aTestClass.method();
104
waitForTestCase(0);
105
break;
106
107
case 1: resume004aTestClass.method();
108
break;
109
110
case 2: resume004aTestClass.method();
111
112
//------------------------------------------------- standard end section
113
114
default:
115
instruction = end;
116
methodForCommunication();
117
break label0;
118
}
119
}
120
121
log1("debuggee exits");
122
System.exit(exitCode + PASS_BASE);
123
}
124
// Synchronize with debugger progression.
125
static void waitForTestCase(int t) {
126
while (testCase < t) {
127
try {
128
Thread.sleep(100);
129
} catch (InterruptedException e) {
130
// ignored
131
}
132
}
133
}
134
}
135
136
class resume004aTestClass {
137
138
static int breakpointLine = 3;
139
static String awFieldName = "var1";
140
static String mwFieldName = "var2";
141
142
static int var1 = 0;
143
static int var2 = 0;
144
static int var3 = 0;
145
146
static void method () {
147
var1 = 1;
148
var3 = var1;
149
var2 = var3;
150
}
151
}
152
153