Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/up/up002/up002.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
* @summary converted from VM Testbase nsk/jdb/up/up002.
29
* VM Testbase keywords: [jpda, jdb]
30
* VM Testbase readme:
31
* DECSRIPTION
32
* This tests the jdb 'up' command. The test sets a breakpoint
33
* at 'func5' method in debugged 'nsk.jdb.up.up002a' class and then
34
* runs the debugee. Once, an execution suspends at 'func5' method,
35
* the 'up' command is issued to the debugger several times.
36
* The output is processed by counting the number of times
37
* each method name appears in the stack trace. The test passes
38
* if the obtained count matches the expected one.
39
* COMMENTS
40
* This test functionally equals to nsk/jdb/up/up001 test and
41
* replaces it.
42
*
43
* @library /vmTestbase
44
* /test/lib
45
* @build nsk.jdb.up.up002.up002a
46
* @run main/othervm
47
* nsk.jdb.up.up002.up002
48
* -arch=${os.family}-${os.simpleArch}
49
* -waittime=5
50
* -debugee.vmkind=java
51
* -transport.address=dynamic
52
* -jdb=${test.jdk}/bin/jdb
53
* -java.options="${test.vm.opts} ${test.java.opts}"
54
* -workdir=.
55
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
56
*/
57
58
package nsk.jdb.up.up002;
59
60
import nsk.share.*;
61
import nsk.share.jdb.*;
62
63
import java.io.*;
64
import java.util.*;
65
66
public class up002 extends JdbTest {
67
68
public static void main (String argv[]) {
69
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
70
}
71
72
public static int run(String argv[], PrintStream out) {
73
debuggeeClass = DEBUGGEE_CLASS;
74
firstBreak = FIRST_BREAK;
75
lastBreak = LAST_BREAK;
76
return new up002().runTest(argv, out);
77
}
78
79
static final String PACKAGE_NAME = "nsk.jdb.up.up002";
80
static final String TEST_CLASS = PACKAGE_NAME + ".up002";
81
static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
82
static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";
83
static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";
84
85
static final String[][] FRAMES = new String[][] {
86
{"[1]", DEBUGGEE_CLASS + ".func5"},
87
{"[2]", DEBUGGEE_CLASS + ".func4"},
88
{"[3]", DEBUGGEE_CLASS + ".func3"},
89
{"[4]", DEBUGGEE_CLASS + ".func2"},
90
{"[5]", DEBUGGEE_CLASS + ".func1"},
91
{"[6]", DEBUGGEE_CLASS + ".runIt"},
92
{"[7]", DEBUGGEE_CLASS + ".main"}
93
};
94
95
protected void runCases() {
96
String[] reply;
97
Paragrep grep;
98
int count;
99
Vector v;
100
String found;
101
102
jdb.receiveReplyFor(JdbCommand.stop_in + DEBUGGEE_CLASS + ".func5");
103
jdb.receiveReplyFor(JdbCommand.cont);
104
105
for (int i = 0; i < FRAMES.length; i++) {
106
jdb.receiveReplyFor(JdbCommand.where);
107
jdb.receiveReplyFor(JdbCommand.up);
108
}
109
110
jdb.contToExit(1);
111
112
reply = jdb.getTotalReply();
113
grep = new Paragrep(reply);
114
115
for (int i = 1; i < (FRAMES.length-1); i++) {
116
v = new Vector();
117
v.add(FRAMES[i][0]);
118
v.add(FRAMES[i][1]);
119
count = grep.find(v);
120
if (count != (i+1)) {
121
failure("Unexpected number of the stack frame: " + FRAMES[i][1] +
122
"\n\texpected value : " + (i+1) + ", got : " + count);
123
}
124
}
125
126
}
127
128
}
129
130