agent/test/jdi/sagtest.java

Wed, 02 Apr 2008 12:09:59 -0700

author
jrose
date
Wed, 02 Apr 2008 12:09:59 -0700
changeset 535
c7c777385a15
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6667042: PrintAssembly option does not work without special plugin
Summary: remove old private plugin interface, simplify, rework old plugin to use unchanged Gnu sources
Reviewed-by: kvn, rasbold

     1 /*
     2  * Copyright 2002-2004 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    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.*;
    40 import java.util.*;
    42     /********** target program **********/
    44 // The target program is sagtarg.java
    46     /********** test program **********/
    48 public class sagtest extends TestScaffold {
    49     ReferenceType targetClass;
    50     ThreadReference mainThread;
    52     sagtest (String args[]) {
    53         super(args);
    54     }
    56     public static void main(String[] args)      throws Exception {
    57         new sagtest(args).startTests();
    58     }
    60     /********** event handlers **********/
    63     /********** test core **********/
    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
    80         sagdoit mine = new sagdoit(vm());
    81         mine.doAll();
    83         if (!testFailed) {
    84             println("sagtest: passed");
    85         } else {
    86             throw new Exception("sagtest: failed");
    87         }
    88     }
    89 }

mercurial