Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/GetValues/getvalues001a.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.jdwp.ObjectReference.GetValues;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdwp.*;2829import java.io.*;3031public class getvalues001a {3233public static final String OBJECT_FIELD_NAME = "object";3435public static void main(String args[]) {36getvalues001a _getvalues001a = new getvalues001a();37System.exit(getvalues001.JCK_STATUS_BASE + _getvalues001a.runIt(args, System.err));38}3940public int runIt(String args[], PrintStream out) {41//make log for debugee messages42ArgumentHandler argumentHandler = new ArgumentHandler(args);43Log log = new Log(out, argumentHandler);4445// meke communication pipe to debugger46log.display("Creating pipe");47IOPipe pipe = argumentHandler.createDebugeeIOPipe(log);4849// ensure tested class loaded50log.display("Creating object of tested class");51TestedClass.object = new TestedClass();5253// send debugger signal READY54log.display("Sending signal to debugger: " + getvalues001.READY);55pipe.println(getvalues001.READY);5657// wait for signal QUIT from debugeer58log.display("Waiting for signal from debugger: " + getvalues001.QUIT);59String signal = pipe.readln();60log.display("Received signal from debugger: " + signal);6162// check received signal63if (! signal.equals(getvalues001.QUIT)) {64log.complain("Unexpected communication signal from debugee: " + signal65+ " (expected: " + getvalues001.QUIT + ")");66log.display("Debugee FAILED");67return getvalues001.FAILED;68}6970// exit debugee71log.display("Debugee PASSED");72return getvalues001.PASSED;73}7475// tested class with own static fields values76public static class TestedClass {7778// static field with tested object79public static TestedClass object = null;8081// fields with tested values82private boolean booleanValue = true;83private final byte byteValue = (byte)0x0F;84protected char charValue = 'Z';85protected final int intValue = 100;86public short shortValue = (short)10;87public final long longValue = (long)1000000;88float floatValue = (float)3.14;89final double doubleValue = (double)2.8e-12;90TestedClass objectValue = null;91}92}939495