Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/resume/resume002/resume002.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/resume/resume002.
29
* VM Testbase keywords: [jpda, jdb]
30
* VM Testbase readme:
31
* DECSRIPTION
32
* This is a test for jdb 'resume all' and 'resume <thread id>' commands.
33
* The debuggee starts 5 'MyThreads' that are all suspended on the lock
34
* that the main thread holds. The the test driver issues the following
35
* commands for check:
36
* - 'suspend all' : "All threads suspended" message is expected in
37
* jdb output stream;
38
* - 'resume all' : "All threads resumed" message is expected in
39
* jdb output stream;
40
* - 'suspend <thread_id>' for each 'MyThread';
41
* - 'resume <thread_id>' for each 'MyThread'.
42
* The test consists of two parts:
43
* resume002.java - test driver, i.e. launches jdb and debuggee,
44
* writes commands to jdb, reads the jdb output,
45
* resume002a.java - the debugged application.
46
* COMMENTS
47
* This test functionally equals to nsk/jdb/resume/resume001 test
48
* and replaces it.
49
*
50
* @library /vmTestbase
51
* /test/lib
52
* @build nsk.jdb.resume.resume002.resume002a
53
* @run main/othervm
54
* nsk.jdb.resume.resume002.resume002
55
* -arch=${os.family}-${os.simpleArch}
56
* -waittime=5
57
* -debugee.vmkind=java
58
* -transport.address=dynamic
59
* -jdb=${test.jdk}/bin/jdb
60
* -java.options="${test.vm.opts} ${test.java.opts}"
61
* -workdir=.
62
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
63
*/
64
65
package nsk.jdb.resume.resume002;
66
67
import nsk.share.*;
68
import nsk.share.jdb.*;
69
70
import java.io.*;
71
import java.util.*;
72
73
public class resume002 extends JdbTest {
74
75
public static void main (String argv[]) {
76
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
77
}
78
79
public static int run(String argv[], PrintStream out) {
80
debuggeeClass = DEBUGGEE_CLASS;
81
firstBreak = FIRST_BREAK;
82
lastBreak = LAST_BREAK;
83
return new resume002().runTest(argv, out);
84
}
85
86
static final String PACKAGE_NAME = "nsk.jdb.resume.resume002";
87
static final String TEST_CLASS = PACKAGE_NAME + ".resume002";
88
static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
89
static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";
90
static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";
91
92
static final String THREAD_NAME = "MyThread";
93
94
protected void runCases() {
95
String[] reply;
96
Paragrep grep;
97
int count;
98
Vector v;
99
String found;
100
101
jdb.setBreakpointInMethod(LAST_BREAK);
102
jdb.receiveReplyFor(JdbCommand.cont);
103
104
String[] threadIds = jdb.getThreadIds(PACKAGE_NAME + "." + THREAD_NAME);
105
106
reply = jdb.receiveReplyFor(JdbCommand.suspend);
107
grep = new Paragrep(reply);
108
if (grep.find("All threads suspended") == 0) {
109
failure("jdb cannot suspend all threads");
110
}
111
reply = jdb.receiveReplyFor(JdbCommand.resume, false);
112
grep = new Paragrep(reply);
113
if (grep.find("All threads resumed") == 0) {
114
failure("jdb cannot resume all threads");
115
}
116
117
jdb.receiveReplyFor(JdbCommand.thread + threadIds[0]);
118
119
for (int i = 0; i < resume002a.numThreads; i++) {
120
jdb.receiveReplyFor(JdbCommand.suspend + threadIds[i]);
121
jdb.receiveReplyFor(JdbCommand.resume + threadIds[i]);
122
}
123
124
jdb.contToExit(1);
125
}
126
}
127
128