Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location001a.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.Locatable.location;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;282930/**31* This class is used as debuggee application for the location001 JDI test.32*/3334public class location001a {3536//----------------------------------------------------- templete section3738static final int PASSED = 0;39static final int FAILED = 2;40static final int PASS_BASE = 95;4142//-------------------------------------------------- log procedures4344static boolean verbMode = false;4546private static void log1(String message) {47if (verbMode)48System.err.println("**> location001a: " + message);49}5051private static void logErr(String message) {52if (verbMode)53System.err.println("!!**> location001a: " + message);54}5556//====================================================== test program5758static location001aTestClass obj = new location001aTestClass();5960//---------------------------------------------------- main method6162public static void main (String argv[]) {6364for (int i=0; i<argv.length; i++) {65if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {66verbMode = true;67break;68}69}70log1("debuggee started!");7172// informing a debugger of readyness73ArgumentHandler argHandler = new ArgumentHandler(argv);74IOPipe pipe = argHandler.createDebugeeIOPipe();75pipe.println("ready");767778int exitCode = PASSED;79for (int i = 0; ; i++) {8081String instruction;8283log1("waiting for an instruction from the debugger ...");84instruction = pipe.readln();85if (instruction.equals("quit")) {86log1("'quit' recieved");87break ;8889} else if (instruction.equals("newcheck")) {90switch (i) {9192//------------------------------------------------------ section tested9394case 0:95pipe.println("checkready");96break ;9798//------------------------------------------------- standard end section99100default:101pipe.println("checkend");102break ;103}104105} else {106logErr("ERRROR: unexpected instruction: " + instruction);107exitCode = FAILED;108break ;109}110}111112System.exit(exitCode + PASS_BASE);113}114}115116117class location001aTestClass {118119public static boolean bl () { return false; }120public static byte bt () { return 0; }121private static char ch () { return 0; }122protected static double db () { return 0.0d; }123public float fl () { return 0.0f; }124public int in () { return 0; }125private long ln () { return 0; }126protected short sh () { return 0; }127128public void vd () { return ; }129}130131132