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/resume010a.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 resume010 JDI test.
32
*/
33
34
public class resume010a {
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
private 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
57
static resume010aTestClass tcObject = new resume010aTestClass();
58
59
//------------------------------------------------------ common section
60
61
static int exitCode = PASSED;
62
63
static int testCase = -1;
64
static int instruction = 1;
65
static int end = 0;
66
// static int quit = 0;
67
// static int continue = 2;
68
static int maxInstr = 1; // 2;
69
70
static int lineForComm = 2;
71
72
private static void methodForCommunication() {
73
int i1 = instruction;
74
int i2 = i1;
75
int i3 = i2;
76
}
77
//---------------------------------------------------- main method
78
79
public static void main (String argv[]) {
80
81
argHandler = new ArgumentHandler(argv);
82
log = argHandler.createDebugeeLog();
83
84
log1("debuggee started!");
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
resume010aTestClass.method();
104
// Wait for debugger to complete the first test case
105
// before advancing to the first breakpoint
106
waitForTestCase(0);
107
break;
108
109
case 1: resume010aTestClass.method();
110
break;
111
112
case 2: resume010aTestClass.method();
113
114
//------------------------------------------------- standard end section
115
116
default:
117
instruction = end;
118
methodForCommunication();
119
break label0;
120
}
121
}
122
123
System.exit(exitCode + PASS_BASE);
124
}
125
// Synchronize with debugger progression.
126
static void waitForTestCase(int t) {
127
while (testCase < t) {
128
try {
129
Thread.sleep(100);
130
} catch (InterruptedException e) {
131
// ignored
132
}
133
}
134
}
135
}
136
class resume010aTestClass {
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