hotspot/src/jdk.hotspot.agent/test/jdi/sagtest.java
changeset 40100 a9b665f0879f
parent 40099 24807846ffe1
child 40101 3b8101f0fd65
equal deleted inserted replaced
40099:24807846ffe1 40100:a9b665f0879f
     1 /*
       
     2  * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  *
       
    23  */
       
    24 
       
    25 /**
       
    26  *  @test *  @bug 0000000
       
    27  *  @summary This is just an exercise of various JDI elements for use in
       
    28  *           testing the SA/JDI client
       
    29  *
       
    30  *  @author jjh
       
    31  *
       
    32  *  @run build TestScaffold VMConnection TargetListener TargetAdapter sagdoit
       
    33  *  @run compile -g -source 1.5 sagtarg.java
       
    34  *  @run main sagtest
       
    35  */
       
    36 import com.sun.jdi.*;
       
    37 import com.sun.jdi.event.*;
       
    38 import com.sun.jdi.request.*;
       
    39 
       
    40 import java.util.*;
       
    41 
       
    42     /********** target program **********/
       
    43 
       
    44 // The target program is sagtarg.java
       
    45 
       
    46     /********** test program **********/
       
    47 
       
    48 public class sagtest extends TestScaffold {
       
    49     ReferenceType targetClass;
       
    50     ThreadReference mainThread;
       
    51 
       
    52     sagtest (String args[]) {
       
    53         super(args);
       
    54     }
       
    55 
       
    56     public static void main(String[] args)      throws Exception {
       
    57         new sagtest(args).startTests();
       
    58     }
       
    59 
       
    60     /********** event handlers **********/
       
    61 
       
    62 
       
    63     /********** test core **********/
       
    64 
       
    65     protected void runTests() throws Exception {
       
    66         /*
       
    67          * Get to the top of main()
       
    68          * to determine targetClass and mainThread
       
    69          */
       
    70         BreakpointEvent bpe = startToMain("sagtarg");
       
    71         targetClass = bpe.location().declaringType();
       
    72         mainThread = bpe.thread();
       
    73         EventRequestManager erm = vm().eventRequestManager();
       
    74         stepOverLine(mainThread);  //stop on 18
       
    75         stepOverLine(mainThread);  //stop on 19
       
    76         stepOverLine(mainThread);  //stop on 20
       
    77         stepOverLine(mainThread);  //stop on 21
       
    78         stepOverLine(mainThread);  //stop on 22
       
    79 
       
    80         sagdoit mine = new sagdoit(vm());
       
    81         mine.doAll();
       
    82 
       
    83         if (!testFailed) {
       
    84             println("sagtest: passed");
       
    85         } else {
       
    86             throw new Exception("sagtest: failed");
       
    87         }
       
    88     }
       
    89 }