Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/LineTable/linetable001a.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*/2223// THIS TEST IS LINE NUMBER SENSITIVE2425package nsk.jdwp.Method.LineTable;2627import nsk.share.*;28import nsk.share.jpda.*;29import nsk.share.jdwp.*;3031import java.io.*;3233/**34* This class represents debuggee part in the test.35*/36public class linetable001a {3738public static final int FIRST_LINE_NUMBER = 86;39public static final int LAST_LINE_NUMBER = 97;4041public static void main(String args[]) {42linetable001a _linetable001a = new linetable001a();43System.exit(linetable001.JCK_STATUS_BASE + _linetable001a.runIt(args, System.err));44}4546public int runIt(String args[], PrintStream out) {47//make log for debugee messages48ArgumentHandler argumentHandler = new ArgumentHandler(args);49Log log = new Log(out, argumentHandler);5051// make communication pipe to debugger52log.display("Creating pipe");53IOPipe pipe = argumentHandler.createDebugeeIOPipe(log);5455// ensure tested class loaded56log.display("Creating object of tested class");57TestedClass foo = new TestedClass();5859// send debugger signal READY60log.display("Sending signal to debugger: " + linetable001.READY);61pipe.println(linetable001.READY);6263// wait for signal QUIT from debugeer64log.display("Waiting for signal from debugger: " + linetable001.QUIT);65String signal = pipe.readln();66log.display("Received signal from debugger: " + signal);6768// check received signal69if (! signal.equals(linetable001.QUIT)) {70log.complain("Unexpected communication signal from debugee: " + signal71+ " (expected: " + linetable001.QUIT + ")");72log.display("Debugee FAILED");73return linetable001.FAILED;74}7576// exit debugee77log.display("Debugee PASSED");78return linetable001.PASSED;79}8081// tested class82public static class TestedClass {83int foo = 0;8485public void testedMethod() { // FIRST_LINE_NUMBER86foo = 1; // foo == 187foo++; // foo == 288foo++; // foo == 389foo++; // foo == 490foo++; // foo == 591foo++; // foo == 692foo++; // foo == 793foo++; // foo == 894foo++; // foo == 995foo++; // foo == 1096} // LAST_LINE_NUMBER97}9899}100101102