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.DoubleValue.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 debuggee 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 //-------------------------------------------------- log procedures 44 45 static boolean verbMode = false; // debugger may switch to true 46 log1(String message)47 private static void log1(String message) { 48 if (verbMode) 49 System.err.println("**> value001a: " + message); 50 } 51 logErr(String message)52 private static void logErr(String message) { 53 if (verbMode) 54 System.err.println("!!**> value001a: " + message); 55 } 56 57 //====================================================== test program 58 //................................................... globals for a debugger 59 60 public static double pos_inf = Double.POSITIVE_INFINITY; 61 public static double pos_zero = 0.0d; 62 public static double neg_zero = -0.0d; 63 public static double neg_inf = Double.NEGATIVE_INFINITY; 64 65 public static double pos_largest = Double.MAX_VALUE; 66 public static double pos_smallest = Double.MIN_VALUE; 67 public static double neg_largest = -Double.MAX_VALUE; 68 public static double neg_smallest = -Double.MIN_VALUE; 69 70 public static double double_nan = Double.NaN; 71 72 // public static double plus1_1 = +1.0d; 73 // public static double plus1_2 = +1.0d; 74 // public static double minus1 = -1.0d; 75 76 // public static float float_plus1 = +1.0f; 77 78 //.................................................... 79 //---------------------------------------------------- main method 80 main(String argv[])81 public static void main (String argv[]) { 82 83 for (int i=0; i<argv.length; i++) { 84 if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) { 85 verbMode = true; 86 break; 87 } 88 } 89 log1("debuggee started!"); 90 91 // informing a debugger of readyness 92 ArgumentHandler argHandler = new ArgumentHandler(argv); 93 IOPipe pipe = argHandler.createDebugeeIOPipe(); 94 pipe.println("ready"); 95 96 97 int exitCode = PASSED; 98 for (int i = 0; ; i++) { 99 100 String instruction; 101 102 log1("waiting for an instruction from the debugger ..."); 103 instruction = pipe.readln(); 104 if (instruction.equals("quit")) { 105 log1("'quit' recieved"); 106 break ; 107 108 } else if (instruction.equals("newcheck")) { 109 switch (i) { 110 111 //------------------------------------------------------ section tested 112 113 case 0: 114 pipe.println("checkready"); 115 break ; 116 117 //------------------------------------------------- standard end section 118 119 default: 120 pipe.println("checkend"); 121 break ; 122 } 123 124 } else { 125 logErr("ERRROR: unexpected instruction: " + instruction); 126 exitCode = FAILED; 127 break ; 128 } 129 } 130 131 System.exit(exitCode + PASS_BASE); 132 } 133 } 134