Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/step/step002/step002.java
40955 views
1
/*
2
* Copyright (c) 2003, 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/step/step002.
29
* VM Testbase keywords: [jpda, jdb]
30
* VM Testbase readme:
31
* DECSRIPTION
32
* The test for the 'step' command.
33
* The test checks the following cases:
34
* - step inside current method,
35
* - step into called method,
36
* - step up to calling method.
37
* The test works as follows. The jdb sets breakpoint at the line
38
* where new value is assigned to local variable. The jdb issues
39
* 'step' command. Then the test checks whether a step is done by
40
* requesting a value of local variable using 'eval' command.
41
* The next two cases are checked with a pair of 'step' and
42
* 'where' commands. The test checks a stack trace after step
43
* using 'where' command.
44
* The test consists of two program:
45
* step002.java - test driver, i.e. launches jdb and debuggee,
46
* writes commands to jdb, reads the jdb output,
47
* step002a.java - the debugged application.
48
* COMMENTS
49
* This test replaces the nsk/jdb/step/step002 one.
50
*
51
* @library /vmTestbase
52
* /test/lib
53
* @build nsk.jdb.step.step002.step002
54
*
55
* @comment make sure step002a is compiled w/ full debug info
56
* @clean nsk.jdb.step.step002.step002a
57
* @compile -g:lines,source,vars step002a.java
58
*
59
* @run main/othervm
60
* nsk.jdb.step.step002.step002
61
* -arch=${os.family}-${os.simpleArch}
62
* -waittime=5
63
* -debugee.vmkind=java
64
* -transport.address=dynamic
65
* -jdb=${test.jdk}/bin/jdb
66
* -java.options="${test.vm.opts} ${test.java.opts}"
67
* -workdir=.
68
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
69
*/
70
71
package nsk.jdb.step.step002;
72
73
import nsk.share.*;
74
import nsk.share.jdb.*;
75
76
import java.io.*;
77
import java.util.*;
78
79
public class step002 extends JdbTest {
80
81
public static void main (String argv[]) {
82
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
83
}
84
85
public static int run(String argv[], PrintStream out) {
86
debuggeeClass = DEBUGGEE_CLASS;
87
firstBreak = FIRST_BREAK;
88
lastBreak = LAST_BREAK;
89
return new step002().runTest(argv, out);
90
}
91
92
static final String PACKAGE_NAME = "nsk.jdb.step.step002";
93
static final String TEST_CLASS = PACKAGE_NAME + ".step002";
94
static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
95
static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";
96
static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";
97
static final int BREAKPOINT_LINE = 50;
98
99
protected void runCases() {
100
String[] reply;
101
Paragrep grep;
102
int count;
103
Vector v;
104
String found;
105
String[] threads;
106
107
reply = jdb.receiveReplyFor(JdbCommand.stop_at + DEBUGGEE_CLASS + ":" + BREAKPOINT_LINE);
108
reply = jdb.receiveReplyFor(JdbCommand.cont);
109
110
// case #1 : step inside frame;
111
reply = jdb.receiveReplyFor(JdbCommand.step);
112
reply = jdb.receiveReplyFor(JdbCommand.eval + "intVar");
113
grep = new Paragrep(reply);
114
if (grep.find("1234") == 0) {
115
failure("CASE #1 FAILED: Wrong location after step inside current method");
116
}
117
118
// case #1 : step into called frame;
119
reply = jdb.receiveReplyFor(JdbCommand.step);
120
reply = jdb.receiveReplyFor(JdbCommand.where);
121
grep = new Paragrep(reply);
122
if (grep.find("foo") == 0) {
123
failure("CASE #2 FAILED: Wrong location after step into called method");
124
}
125
126
// case #1 : step out to calling frame;
127
reply = jdb.receiveReplyFor(JdbCommand.step);
128
reply = jdb.receiveReplyFor(JdbCommand.where);
129
grep = new Paragrep(reply);
130
if (grep.find("foo") > 0) {
131
failure("CASE #2 FAILED: Wrong location after step up to calling method");
132
}
133
if (grep.find("runIt") == 0) {
134
failure("CASE #2 FAILED: Wrong location after step up to calling method");
135
}
136
137
jdb.contToExit(1);
138
}
139
}
140
141