Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/Locatable/location/location003a.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 location003 JDI test.32*/3334public class location003a {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("**> location003a: " + message);49}5051private static void logErr(String message) {52if (verbMode)53System.err.println("!!**> location003a: " + message);54}5556//====================================================== test program5758static location003aTestClass obj = new location003aTestClass();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 location003aTestClass {118119private location003aClassForCheck2 class2 = new location003aClassForCheck2();120121private location003aClassForCheck1 classFC = new location003aClassForCheck1();122private location003aInterfaceForCheck iface = class2;123private location003aClassForCheck1 cfc[] = { new location003aClassForCheck1(), new location003aClassForCheck1() };124125public location003aClassForCheck1[] arraymethod () {126return cfc;127}128public location003aClassForCheck1 classmethod () {129return classFC;130}131public location003aInterfaceForCheck ifacemethod () {132return iface;133}134}135136137interface location003aInterfaceForCheck {138139// static final boolean s_iface_boolean = true;140static final byte s_iface_byte = (byte)1;141static final char s_iface_char = '1';142static final double s_iface_double = 999;143static final float s_iface_float = 99;144static final int s_iface_int = 100;145static final long s_iface_long = 1000;146static final Object s_iface_object = new Object();147}148149class location003aClassForCheck2 implements location003aInterfaceForCheck {150}151152class location003aClassForCheck1 {153154// static fields155/*156static location003aClassForCheck2[] class3 = { new location003aClassForCheck2() };157static location003aClassForCheck2 class2 = new location003aClassForCheck2();158159static location003aInterfaceForCheck iface;160*/161static boolean bl[] = {true, false};162163static boolean s_boolean;164static byte s_byte;165static char s_char;166static double s_double;167static float s_float;168static int s_int;169static long s_long;170171// instance fields172173boolean i_boolean;174byte i_byte;175char i_char;176double i_double;177float i_float;178int i_int;179long i_long;180}181182183