Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/BooleanValue/value/value001a.java
41161 views
/*1* Copyright (c) 2000, 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.BooleanValue.value;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;282930/**31* This class is used as debugee application for the value001a JDI test.32*/3334public class value001a {3536//----------------------------------------------------- templete section3738static final int PASSED = 0;39static final int FAILED = 2;40static final int PASS_BASE = 95;414243//-------------------------------------------------- log procedures4445private static boolean verbMode = false;4647private static void log1(String message) {48if (verbMode)49System.err.println("**> value001a: " + message);50}5152private static void logErr(String message) {53if (verbMode)54System.err.println("!!**> value001a: " + message);55}5657//====================================================== test program5859//................................................... globals for a debugger6061public static boolean bTrue1 = true;62public static boolean bTrue2 = true;63public static boolean bFalse1 = false;64public static boolean bFalse2 = false;6566//....................................................6768//---------------------------------------------------- main method6970public static void main (String argv[]) {7172for (int i=0; i<argv.length; i++) {73if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {74verbMode = true;75break;76}77}78log1("debugee started!");7980// informing debuger of readyness81ArgumentHandler argHandler = new ArgumentHandler(argv);82IOPipe pipe = argHandler.createDebugeeIOPipe();83pipe.println("ready");848586int exitCode = PASSED;87for (int i = 0; ; i++) {8889String instruction;9091log1("waiting for an instruction from the debuger ...");92instruction = pipe.readln();93if (instruction.equals("quit")) {94log1("'quit' recieved");95break ;9697} else if (instruction.equals("newcheck")) {9899switch (i) {100//------------------------------------------------------ section tested101102case 0:103pipe.println("checkready");104break ;105106//------------------------------------------------- standard end section107default:108pipe.println("checkend");109break ;110}111112} else {113logErr("ERRROR: unexpected instruction: " + instruction);114exitCode = 2;115break ;116}117}118119System.exit(exitCode + PASS_BASE);120}121}122123124