Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/agent/test/jdi/sagtest.java
38764 views
/*1* Copyright (c) 2002, 2004, 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*22*/2324/**25* @test * @bug 000000026* @summary This is just an exercise of various JDI elements for use in27* testing the SA/JDI client28*29* @author jjh30*31* @run build TestScaffold VMConnection TargetListener TargetAdapter sagdoit32* @run compile -g -source 1.5 sagtarg.java33* @run main sagtest34*/35import com.sun.jdi.*;36import com.sun.jdi.event.*;37import com.sun.jdi.request.*;3839import java.util.*;4041/********** target program **********/4243// The target program is sagtarg.java4445/********** test program **********/4647public class sagtest extends TestScaffold {48ReferenceType targetClass;49ThreadReference mainThread;5051sagtest (String args[]) {52super(args);53}5455public static void main(String[] args) throws Exception {56new sagtest(args).startTests();57}5859/********** event handlers **********/606162/********** test core **********/6364protected void runTests() throws Exception {65/*66* Get to the top of main()67* to determine targetClass and mainThread68*/69BreakpointEvent bpe = startToMain("sagtarg");70targetClass = bpe.location().declaringType();71mainThread = bpe.thread();72EventRequestManager erm = vm().eventRequestManager();73stepOverLine(mainThread); //stop on 1874stepOverLine(mainThread); //stop on 1975stepOverLine(mainThread); //stop on 2076stepOverLine(mainThread); //stop on 2177stepOverLine(mainThread); //stop on 227879sagdoit mine = new sagdoit(vm());80mine.doAll();8182if (!testFailed) {83println("sagtest: passed");84} else {85throw new Exception("sagtest: failed");86}87}88}899091