Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where005/where005.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/where005.
29
* VM Testbase keywords: [jpda, jdb]
30
* VM Testbase readme:
31
* DECSRIPTION
32
* A test case for the 'where' command. The debugged 'where005a'
33
* application throws a null pointer exception in 'func6()' method.
34
* The test passes if the 'where' command produces the correct
35
* stack trace.
36
* COMMENTS
37
* This test functionally equals to nsk/jdb/where/where002 test
38
* and replaces it.
39
* Modified due to fix of the bug:
40
* 4818762 TEST_BUG: two jdb test incorrectly check debuggee exit code
41
*
42
* @library /vmTestbase
43
* /test/lib
44
* @build nsk.jdb.where.where005.where005a
45
* @run main/othervm
46
* nsk.jdb.where.where005.where005
47
* -arch=${os.family}-${os.simpleArch}
48
* -waittime=5
49
* -debugee.vmkind=java
50
* -transport.address=dynamic
51
* -jdb=${test.jdk}/bin/jdb
52
* -java.options="${test.vm.opts} ${test.java.opts}"
53
* -workdir=.
54
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
55
*/
56
57
package nsk.jdb.where.where005;
58
59
import nsk.share.*;
60
import nsk.share.jdb.*;
61
62
import java.io.*;
63
import java.util.*;
64
65
public class where005 extends JdbTest {
66
67
public static void main (String argv[]) {
68
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
69
}
70
71
public static int run(String argv[], PrintStream out) {
72
debuggeeClass = DEBUGGEE_CLASS;
73
firstBreak = FIRST_BREAK;
74
lastBreak = LAST_BREAK;
75
return new where005(true).runTest(argv, out);
76
}
77
78
public where005 (boolean debuggeeShouldFail) {
79
super(debuggeeShouldFail);
80
}
81
82
static final String PACKAGE_NAME = "nsk.jdb.where.where005";
83
static final String TEST_CLASS = PACKAGE_NAME + ".where005";
84
static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
85
static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";
86
static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";
87
88
static final String[][] FRAMES = new String[][] {
89
{DEBUGGEE_CLASS + ".func6", "76"},
90
{DEBUGGEE_CLASS + ".func5", "71"},
91
{DEBUGGEE_CLASS + ".func4", "67"},
92
{DEBUGGEE_CLASS + ".func3", "63"},
93
{DEBUGGEE_CLASS + ".func2", "59"},
94
{DEBUGGEE_CLASS + ".func1", "55"},
95
{DEBUGGEE_CLASS + ".runIt", "48"},
96
{DEBUGGEE_CLASS + ".main", "39"}
97
};
98
protected void runCases() {
99
String[] reply;
100
Paragrep grep;
101
int count;
102
Vector v;
103
String found;
104
105
reply = jdb.receiveReplyFor(JdbCommand.cont);
106
grep = new Paragrep(reply);
107
108
if (grep.find("NullPointerException") == 0) {
109
failure("Expected NullPointerException is not thrown");
110
} else {
111
reply = jdb.receiveReplyFor(JdbCommand.where);
112
grep = new Paragrep(reply);
113
114
for (int i = 0; i < FRAMES.length; i++) {
115
v = new Vector();
116
v.add(FRAMES[i][0]);
117
v.add(FRAMES[i][1]);
118
count = grep.find(v);
119
if (count != 1) {
120
failure("Unexpected number or location of the stack frame: " + FRAMES[i][0] +
121
"\n\texpected value : 1, got one: " + count);
122
}
123
}
124
}
125
jdb.sendCommand(JdbCommand.quit);
126
}
127
}
128
129