hotspot/agent/test/jdi/sagdoit.java
author trims
Thu, 27 May 2010 19:08:38 -0700
changeset 5547 f4b087cbb361
parent 1 489c9b5090e2
permissions -rw-r--r--
6941466: Oracle rebranding changes for Hotspot repositories Summary: Change all the Sun copyrights to Oracle copyright Reviewed-by: ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
     2
 * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
import com.sun.jdi.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
import java.util.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
// This just contains a bunch of methods that call various JDI methods.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
// It is called from the sagtest.java jtreg test to get this info for the standard
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// JDI and from the sagclient.java test to get this info for the SA JDI.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
class comparator implements Comparator {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
    public int compare(Object o1, Object o2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
        ReferenceType rt1 = (ReferenceType)o1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
        ReferenceType rt2 = (ReferenceType)o2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
        return rt1.signature().compareTo(rt2.signature());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    public boolean equals(Object oo) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
        return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
public class sagdoit {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    VirtualMachine myVm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    int margin = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    static String blanks = "                                                        ";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    static int nblanks = blanks.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    sagdoit(VirtualMachine vm) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
        super();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
        myVm = vm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    void indent(int count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
        margin += count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    void pp(String msg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
        System.out.println(blanks.substring(nblanks - margin) + msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    public void doAll() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
        doThreadGroups();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
        //System.out.println("NOTE: dumping of class info is disabled in sagdoit.java");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
        //System.out.println("      just to keep the output small while working on objects");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
        doClasses();  //fixme jj: uncomment this to see all class info
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    public void doThreadGroups() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
        doThreadGroupList(myVm.topLevelThreadGroups());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    private void doThreadGroupList(List groups) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
        // sort; need a comparator
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
        if (groups == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
            return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
        Iterator myIter = groups.iterator();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
        while(myIter.hasNext()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
            ThreadGroupReference aGroup = (ThreadGroupReference)myIter.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
            doOneThreadGroup(aGroup);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    public void doOneThreadGroup(ThreadGroupReference xx) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
        pp("threadGroup:" + xx.name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
        indent(4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
        pp("parent()       = " + xx.parent());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
        pp("threads:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
        indent(4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
        doThreadList(xx.threads());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
        indent(-4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
        pp("threadGroups:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
        indent(4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
        doThreadGroupList(xx.threadGroups());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
        indent(-4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
        indent(-4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    public void doThreads() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
        doThreadList(myVm.allThreads());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    public void doThreadList(List threads) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
        if (threads == null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
            return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
        Iterator myIter = threads.iterator();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
        while(myIter.hasNext()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
            ThreadReference aThread = (ThreadReference)myIter.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
            doOneThread(aThread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    public void doOneThread(ThreadReference xx) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
        pp("Thread: " + xx.name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
        indent(4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
        pp("suspendCount()      = " + xx.suspendCount());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
        //void stop(ObjectReference throwable) throws InvalidTypeException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
        //void interrupt();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
        pp("status()            = " + xx.status());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
        pp("isSuspended()       = " + xx.isSuspended());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
        pp("isAtBreakpoint()    = " + xx.isAtBreakpoint());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
        pp("threadGroup()       = " + xx.threadGroup());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
        indent(-4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
        indent(4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
            List allFrames = xx.frames();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
            for (int ii = 0; ii < xx.frameCount(); ii++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
                StackFrame oneFrame = xx.frame(ii);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
                pp("frame(" + ii + ") = " + oneFrame);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
                doOneFrame(oneFrame);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
            //List frames(int start, int length) throws IncompatibleThreadStateException;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
            // unsupported List allMonitors = xx.ownedMonitors();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
            // unsupported pp("currentContendedMonitor() = " + xx.currentContendedMonitor());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
        } catch (IncompatibleThreadStateException ee) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
            pp("GOT IncompatibleThreadStateException: " + ee);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
        indent(-4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    public void doOneFrame(StackFrame frame) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
        List localVars = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
            localVars = frame.visibleVariables();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
        } catch (AbsentInformationException ee) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
            // we compile with -g so this shouldn't happen
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
            return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
        indent(4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
        for (Iterator it = localVars.iterator(); it.hasNext();) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
            LocalVariable lv = (LocalVariable) it.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
            pp("lv name = " + lv.name() +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
               ", type =  " + lv.typeName() +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
               ", sig =   " + lv.signature() +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
               ", gsig =  " + lv.genericSignature() +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
               ", isVis = " + lv.isVisible(frame) +
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
               ", isArg = " + lv.isArgument());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
        indent(-4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    public void doClasses() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
        List myClasses = myVm.allClasses();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
        myClasses = new ArrayList(myClasses);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
        Collections.sort(myClasses, new comparator());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
        for (int ii = 0; ii < myClasses.size(); ii++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
            // Spec says each is a ReferenceType
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
            //System.out.println("class " + (ii + 1) + " is " + myClasses.get(ii));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
            ReferenceType aClass = (ReferenceType)myClasses.get(ii);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
            System.out.println("class " + (ii + 1) + " is " + aClass.signature());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
            doOneClass(aClass);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
            // Uncomment this to just do a few classes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
            //if ( ii > 4) break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    public void doOneClass(ReferenceType xx) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
        indent(5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
        // inherited from Mirror
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
        pp("toString()       = " + xx.toString());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
        pp("virtualMachine() = " + xx.virtualMachine());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
        // inherited from Type
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
        pp("name()           = " + xx.name());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
        pp("signature()      = " + xx.signature());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
        // ReferenceType fields
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
        doReferenceTypeFields(xx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
        String className = xx.getClass().getName();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
        pp("subclass           = " + className);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
         Class referenceType = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
         Class arrayType = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
         Class classType = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
         Class interfaceType = null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
         try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
             referenceType = Class.forName("com.sun.jdi.ReferenceType");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
             arrayType = Class.forName("com.sun.jdi.ArrayType");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
             interfaceType = Class.forName("com.sun.jdi.InterfaceType");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
             classType = Class.forName("com.sun.jdi.ClassType");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
         } catch (ClassNotFoundException ee) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
         if (referenceType.isInstance(xx)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
             pp("ReferenceType fields");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
             ReferenceType rr = (ReferenceType)xx;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
             if (arrayType.isInstance(xx)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
                 pp("ArrayType fields");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
             if (classType.isInstance(xx)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
                 pp("ClassType fields");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
             if (interfaceType.isInstance(xx)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
                 pp("InterfaceType fields");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
         }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
        indent(-5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  public void doReferenceTypeFields(ReferenceType xx) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
    Object zz;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
      pp("classLoader() = " + xx.classLoader());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
      try {zz =xx.sourceName();} catch(AbsentInformationException ee) { zz = ee;} pp("sourceName() = " + zz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
      try {zz =xx.sourceNames("stratum");} catch(AbsentInformationException ee) { zz = ee;} pp("sourceNames() = " + zz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
      try {zz =xx.sourcePaths("stratum");} catch(AbsentInformationException ee) { zz = ee;} pp("sourcePaths() = " + zz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
      //try {zz =xx.sourceDebugExtension();} catch(AbsentInformationException ee) { zz = ee;} pp("sourceDebugExtension() = " + zz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
      //fixme: jj; should sourceDebugExtension throw UnsupportedOperationException?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
      try {zz =xx.sourceDebugExtension();} catch(Exception ee) { zz = ee;} pp("sourceDebugExtension() = " + zz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
      // If xx is an array, this can cause a ClassNotLoadedException on the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
      // component type.  Is that a JDI bug?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
      pp("isStatic() = " + xx.isStatic());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
      pp("isAbstract() = " + xx.isAbstract());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
      pp("isFinal() = " + xx.isFinal());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
      pp("isPrepared() = " + xx.isPrepared());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
      pp("isVerified() = " + xx.isVerified());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
      pp("isInitialized() = " + xx.isInitialized());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
      pp("failedToInitialize() = " + xx.failedToInitialize());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
      pp("fields() = " + xx.fields());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
      pp("visibleFields() = " + xx.visibleFields());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
      pp("allFields() = " + xx.allFields());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
      pp("fieldByName(String fieldName) = " + xx.fieldByName("fieldName"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
      pp("methods() = " + xx.methods());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
       List meths = xx.methods();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
       Iterator iter = meths.iterator();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
       while (iter.hasNext()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
           Method mm = (Method)iter.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
           pp("  name/sig:" + mm.name() + "/" + mm.signature());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
       }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
      pp(" visibleMethods() = " + xx.visibleMethods());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
      //if (1 == 1) return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
      pp("allMethods() = " + xx.allMethods());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
      pp("methodsByName(String name) = " + xx.methodsByName("name"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
      pp("methodsByName(String name, String signature) = " + xx.methodsByName("name", "signature"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
      pp("nestedTypes() = " + xx.nestedTypes());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
      //pp("getValue(Field field) = " + xx.getValue("field"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
      pp("getValue(Field field) = " + "fixme: jjh");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
      //pp("getValues(List fields) = " + xx.getValues(new List[] = {"fields"}));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
      pp("getValues(List fields) = " + "fixme: jjh");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
      pp("classObject() = " + xx.classObject());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
      //x      pp("allLineLocations() = " + xx.allLineLocations());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
      //x      pp("allLineLocations(String stratum, String sourceName) = " + xx.allLineLocations("stratum", "sourceName"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
      //x      pp("locationsOfLine(int lineNumber) = " + xx.locationsOfLine(89));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
      //x      pp("locationsOfLine(String stratum, String sourceName, int lineNumber) = " + xx.locationsOfLine("stratum", "sourceName", 89));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
      pp("availableStrata() = " + xx.availableStrata());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
      pp("defaultStratum() = " + xx.defaultStratum());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
      pp("equals(Object obj) = " + xx.equals(xx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
      pp("hashCode() = " + xx.hashCode());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
//         try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
//             ReferenceType rr = (ReferenceType)xx;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
//             pp("ReferenceType fields");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
//             try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
//                 ArrayType ff = (ArrayType)xx;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
//                 pp("ArrayType fields");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
//             } catch(ClassCastException ee) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
//             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
//             try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
//                 ClassType ff = (ClassType)xx;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
//                 pp("ClassType fields");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
//             } catch(ClassCastException ee) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
//             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
//             try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
//                 InterfaceType ff = (InterfaceType)xx;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
//                 pp("InterfaceType fields");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
//             } catch(ClassCastException ee) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
//             }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
//         } catch(ClassCastException ee) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
//         }