Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/suspendPolicy/suspendpolicy001a.java
41161 views
/*1* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package nsk.jdi.EventSet.suspendPolicy;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;2829/**30* This class is used as debuggee application for the suspendpolicy001 JDI test.31*/3233public class suspendpolicy001a {3435//----------------------------------------------------- templete section3637static final int PASSED = 0;38static final int FAILED = 2;39static final int PASS_BASE = 95;4041static ArgumentHandler argHandler;42static Log log;4344//-------------------------------------------------- log procedures4546private static void log1(String message) {47log.display("**> debuggee: " + message);48}4950private static void logErr(String message) {51log.complain("**> debuggee: " + message);52}5354//====================================================== test program55//------------------------------------------------------ common section5657static int exitCode = PASSED;5859static int instruction = 1;60static int end = 0;61// static int quit = 0;62// static int continue = 2;63static int maxInstr = 1; // 2;6465static int lineForComm = 2;6667private static void methodForCommunication() {68int i1 = instruction;69int i2 = i1;70int i3 = i2;71}72//---------------------------------------------------- main method7374public static void main (String argv[]) {7576argHandler = new ArgumentHandler(argv);77log = argHandler.createDebugeeLog();7879log1("debuggee started!");8081int exitCode = PASSED;828384label0:85for (int i = 0; ; i++) {8687if (instruction > maxInstr) {88logErr("ERROR: unexpected instruction: " + instruction);89exitCode = FAILED;90break ;91}9293switch (i) {9495//------------------------------------------------------ section tested9697// Below, there is no the loop of interaction with the debugger for each Event98// because JVMS doesn't guaranties ordering ClassPrepareEvents.99// Therefore the debugger doesn't rely on the event order.100101case 0:102TestClass0 tcObject0 = new TestClass0();103// methodForCommunication();104// break;105106case 1:107TestClass1 tcObject1 = new TestClass1();108// methodForCommunication();109// break;110case 2:111TestClass2 tcObject2 = new TestClass2();112// methodForCommunication();113// break;114115case 3:116TestClass3 tcObject3 = new TestClass3();117// methodForCommunication();118// break;119120case 4:121TestClass4 tcObject4 = new TestClass4();122// methodForCommunication();123// break;124125case 5:126TestClass5 tcObject5 = new TestClass5();127// methodForCommunication();128// break;129130case 6:131TestClass6 tcObject6 = new TestClass6();132133//------------------------------------------------- standard end section134135default:136instruction = end;137methodForCommunication();138break label0;139}140}141142System.exit(exitCode + PASS_BASE);143}144145}146class TestClass0 {147static int var1 = 0;148}149class TestClass1 {150static int var1 = 0;151}152class TestClass2 {153static int var1 = 0;154}155class TestClass3 {156static int var1 = 0;157}158class TestClass4 {159static int var1 = 0;160}161class TestClass5 {162static int var1 = 0;163}164class TestClass6 {165static int var1 = 0;166}167168169