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