Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear003/clear003.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/clear/clear003.
29
* VM Testbase keywords: [jpda, jdb]
30
* VM Testbase readme:
31
* DECSRIPTION
32
* A negative test case for the 'clear <class_id>.<method>' command.
33
* The test sets 2 breakpoints and then tries to clear non-existent
34
* breakpoint after the first breakpoint is reached. The tests verifies
35
* that jdb correctly reports about attempt to clear non-existent
36
* breakpoint.
37
* COMMENTS
38
*
39
* @library /vmTestbase
40
* /test/lib
41
* @build nsk.jdb.clear.clear003.clear003a
42
* @run main/othervm
43
* nsk.jdb.clear.clear003.clear003
44
* -arch=${os.family}-${os.simpleArch}
45
* -waittime=5
46
* -debugee.vmkind=java
47
* -transport.address=dynamic
48
* -jdb=${test.jdk}/bin/jdb
49
* -java.options="${test.vm.opts} ${test.java.opts}"
50
* -workdir=.
51
* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
52
*/
53
54
package nsk.jdb.clear.clear003;
55
56
import nsk.share.*;
57
import nsk.share.jdb.*;
58
59
import java.io.*;
60
import java.util.*;
61
62
public class clear003 extends JdbTest {
63
64
public static void main (String argv[]) {
65
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
66
}
67
68
public static int run(String argv[], PrintStream out) {
69
debuggeeClass = DEBUGGEE_CLASS;
70
firstBreak = FIRST_BREAK;
71
lastBreak = LAST_BREAK;
72
return new clear003().runTest(argv, out);
73
}
74
75
static final String PACKAGE_NAME = "nsk.jdb.clear.clear003";
76
static final String TEST_CLASS = PACKAGE_NAME + ".clear003";
77
static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
78
static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";
79
static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";
80
static final String METHOD4 = "func4";
81
static final String METHOD5 = "func5";
82
static final String METHOD_TO_CLEAR = DEBUGGEE_CLASS + "." + METHOD4;
83
84
protected void runCases() {
85
String[] reply;
86
Paragrep grep;
87
int count;
88
Vector v;
89
String found;
90
91
log.display("Setting breakpoint in method: " + METHOD5);
92
jdb.setBreakpointInMethod(DEBUGGEE_CLASS + "." + METHOD5);
93
94
log.display("Clearing breakpoint.");
95
reply = jdb.receiveReplyFor(JdbCommand.clear + METHOD_TO_CLEAR);
96
grep = new Paragrep(reply);
97
count = grep.find("Removed:");
98
if (count > 0) {
99
log.complain("Cleared non-existent breakpoint in method: " + METHOD_TO_CLEAR);
100
success = false;
101
}
102
103
jdb.contToExit(2);
104
105
grep = new Paragrep(jdb.getTotalReply());
106
count = grep.find(Jdb.BREAKPOINT_HIT);
107
if (count != 2) {
108
log.complain("Should hit 2 breakpoints.");
109
log.complain("Breakpoint hit count reported: " + count);
110
success = false;
111
}
112
}
113
}
114
115