1 /* 2 * Copyright (c) 2000, 2018, 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 package nsk.jdi.BooleanValue.value; 25 26 import nsk.share.*; 27 import nsk.share.jpda.*; 28 import nsk.share.jdi.*; 29 30 31 /** 32 * This class is used as debugee application for the value001a JDI test. 33 */ 34 35 public class value001a { 36 37 //----------------------------------------------------- templete section 38 39 static final int PASSED = 0; 40 static final int FAILED = 2; 41 static final int PASS_BASE = 95; 42 43 44 //-------------------------------------------------- log procedures 45 46 private static boolean verbMode = false; 47 log1(String message)48 private static void log1(String message) { 49 if (verbMode) 50 System.err.println("**> value001a: " + message); 51 } 52 logErr(String message)53 private static void logErr(String message) { 54 if (verbMode) 55 System.err.println("!!**> value001a: " + message); 56 } 57 58 //====================================================== test program 59 60 //................................................... globals for a debugger 61 62 public static boolean bTrue1 = true; 63 public static boolean bTrue2 = true; 64 public static boolean bFalse1 = false; 65 public static boolean bFalse2 = false; 66 67 //.................................................... 68 69 //---------------------------------------------------- main method 70 main(String argv[])71 public static void main (String argv[]) { 72 73 for (int i=0; i<argv.length; i++) { 74 if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) { 75 verbMode = true; 76 break; 77 } 78 } 79 log1("debugee started!"); 80 81 // informing debuger of readyness 82 ArgumentHandler argHandler = new ArgumentHandler(argv); 83 IOPipe pipe = argHandler.createDebugeeIOPipe(); 84 pipe.println("ready"); 85 86 87 int exitCode = PASSED; 88 for (int i = 0; ; i++) { 89 90 String instruction; 91 92 log1("waiting for an instruction from the debuger ..."); 93 instruction = pipe.readln(); 94 if (instruction.equals("quit")) { 95 log1("'quit' recieved"); 96 break ; 97 98 } else if (instruction.equals("newcheck")) { 99 100 switch (i) { 101 //------------------------------------------------------ section tested 102 103 case 0: 104 pipe.println("checkready"); 105 break ; 106 107 //------------------------------------------------- standard end section 108 default: 109 pipe.println("checkend"); 110 break ; 111 } 112 113 } else { 114 logErr("ERRROR: unexpected instruction: " + instruction); 115 exitCode = 2; 116 break ; 117 } 118 } 119 120 System.exit(exitCode + PASS_BASE); 121 } 122 } 123