Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/PopFrames/popframes001a.java
41162 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
// THIS TEST IS LINE NUMBER SENSITIVE
25
26
package nsk.jdwp.StackFrame.PopFrames;
27
28
import nsk.share.*;
29
import nsk.share.jpda.*;
30
import nsk.share.jdwp.*;
31
32
import java.io.*;
33
34
/**
35
* This class represents debuggee part in the test.
36
*/
37
public class popframes001a {
38
39
// name of the tested thread
40
public static final String THREAD_NAME = "testedThread";
41
42
// line nunber for breakpoint
43
public static final int BREAKPOINT_LINE_NUMBER = 113;
44
45
// scaffold objects
46
private static volatile ArgumentHandler argumentHandler = null;
47
private static volatile Log log = null;
48
49
public static void main(String args[]) {
50
popframes001a _popframes001a = new popframes001a();
51
System.exit(popframes001.JCK_STATUS_BASE + _popframes001a.runIt(args, System.err));
52
}
53
54
public int runIt(String args[], PrintStream out) {
55
//make log for debugee messages
56
argumentHandler = new ArgumentHandler(args);
57
log = new Log(out, argumentHandler);
58
59
// create tested thread
60
log.display("Creating testing thread");
61
TestedThreadClass thread = new TestedThreadClass(THREAD_NAME);
62
log.display(" ... thread created");
63
64
// start tested thread
65
log.display("Starting tested thread");
66
thread.start();
67
log.display(" ... thread started");
68
69
// wait for tested thread finished
70
try {
71
log.display("Waiting for tested thread finished");
72
thread.join();
73
log.display(" ... thread finished");
74
} catch(InterruptedException e) {
75
log.complain("Interruption while waiting for tested thread finished:\n\t" + e);
76
log.display("Debugee FAILED");
77
return popframes001.FAILED;
78
}
79
80
log.display("Debugee PASSED");
81
return popframes001.PASSED;
82
}
83
84
// tested thread class
85
public static class TestedThreadClass extends Thread {
86
87
// number of invokations of tested method
88
public static volatile int invokations = 0;
89
90
public TestedThreadClass(String name) {
91
super(name);
92
}
93
94
// invoke tested method
95
public void run() {
96
log.display("Tested thread: started");
97
98
// invoke tested method
99
int foo = 100;
100
foo = testedMethod(foo);
101
102
log.display("Tested thread: finished");
103
}
104
105
// tested method to pop frames
106
public int testedMethod(int arg) {
107
invokations++;
108
log.display("Tested method invoked " + invokations + " time");
109
int boo = 0;
110
111
log.display("Breakpoint line reached");
112
// next line is for breakpoint
113
boo = arg * 2; // BREAKPOINT_LINE_NUMBER
114
log.display("Breakpoint line passed");
115
116
return boo;
117
}
118
}
119
}
120
121