Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.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.resume;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;2829/**30* This class is used as debuggee application for the resume001 JDI test.31*/3233public class resume001a {3435//----------------------------------------------------- template section3637static final int PASSED = 0;38static final int FAILED = 2;39static final int PASS_BASE = 95;4041static ArgumentHandler argHandler;42static Log log;4344//-------------------------------------------------- log procedures4546static 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 testCase = -1;60static int instruction = 1;61static int end = 0;62// static int quit = 0;63// static int continue = 2;64static int maxInstr = 1; // 2;6566static int lineForComm = 2;6768private static void methodForCommunication() {69int i1 = instruction;70int i2 = i1;71int i3 = i2;72}73//---------------------------------------------------- main method7475public static void main (String argv[]) {7677argHandler = new ArgumentHandler(argv);78log = argHandler.createDebugeeLog();7980log1("debuggee started!");818283label0:84for (int i = 0; ; i++) {8586log1("methodForCommunication();");87methodForCommunication();88if (instruction == end)89break;9091if (instruction > maxInstr) {92logErr("ERROR: unexpected instruction: " + instruction);93exitCode = FAILED;94break ;95}9697switch (i) {9899//------------------------------------------------------ section tested100101case 0:102TestClass2 obj2 = new TestClass2();103// Wait for debugger to complete the first test case104// before advancing to the first breakpoint105waitForTestCase(0);106107break;108109case 1:110TestClass3 obj3 = new TestClass3();111break;112113case 2:114TestClass4 obj4 = new TestClass4();115//------------------------------------------------- standard end section116117default:118instruction = end;119break label0;120}121}122123log1("debuggee exits");124System.exit(exitCode + PASS_BASE);125}126// Synchronize with debugger progression.127static void waitForTestCase(int t) {128while (testCase < t) {129try {130Thread.sleep(100);131} catch (InterruptedException e) {132// ignored133}134}135}136}137138class TestClass2 {139static int var1 = 0;140}141142class TestClass3 {143static int var1 = 0;144}145146class TestClass4 {147static int var1 = 0;148}149150151