src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 54836 e2ed0691ae79
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
54836
e2ed0691ae79 8219023: Investigate syncing JVMTI spec version with JDK version
sspitsyn
parents: 50735
diff changeset
     2
 * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include "util.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include "VirtualMachineImpl.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "commonRef.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "inStream.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include "outStream.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include "eventHandler.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "eventHelper.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#include "threadControl.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "SDE.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "FrameID.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
static char *versionName = "Java Debug Wire Protocol (Reference Implementation)";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
version(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    char buf[500];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    char *vmName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    char *vmVersion;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    char *vmInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
54836
e2ed0691ae79 8219023: Investigate syncing JVMTI spec version with JDK version
sspitsyn
parents: 50735
diff changeset
    47
    /* Now the JDWP versions are the same as JVMTI versions */
e2ed0691ae79 8219023: Investigate syncing JVMTI spec version with JDK version
sspitsyn
parents: 50735
diff changeset
    48
    int majorVersion = jvmtiMajorVersion();
e2ed0691ae79 8219023: Investigate syncing JVMTI spec version with JDK version
sspitsyn
parents: 50735
diff changeset
    49
    int minorVersion = 0;
e2ed0691ae79 8219023: Investigate syncing JVMTI spec version with JDK version
sspitsyn
parents: 50735
diff changeset
    50
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    vmVersion = gdata->property_java_version;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    if (vmVersion == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        vmVersion = "<unknown>";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    vmName = gdata->property_java_vm_name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    if (vmName == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        vmName = "<unknown>";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    vmInfo = gdata->property_java_vm_info;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    if (vmInfo == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        vmInfo = "<unknown>";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * Write the descriptive version information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    (void)snprintf(buf, sizeof(buf),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                "%s version %d.%d\nJVM Debug Interface version %d.%d\n"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                 "JVM version %s (%s, %s)",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                  versionName, majorVersion, minorVersion,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
                  jvmtiMajorVersion(), jvmtiMinorVersion(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                  vmVersion, vmName, vmInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    (void)outStream_writeString(out, buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * Write the JDWP version numbers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    (void)outStream_writeInt(out, majorVersion);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    (void)outStream_writeInt(out, minorVersion);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * Write the VM version and name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    (void)outStream_writeString(out, vmVersion);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    (void)outStream_writeString(out, vmName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
classesForSignature(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    JNIEnv *env;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    char *signature;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    signature = inStream_readString(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    if (signature == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    env = getEnv();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    WITH_LOCAL_REFS(env, 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        jint classCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        jclass *theClasses;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        jvmtiError error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        error = allLoadedClasses(&theClasses, &classCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        if ( error == JVMTI_ERROR_NONE ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            /* Count classes in theClasses which match signature */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            int matchCount = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            /* Count classes written to the JDWP connection */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            int writtenCount = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
38334
ccb5cb0c8132 8143921: nsk/jdi/ObjectReference/waitingThreads/waitingthreads003 fails with JVMTI_ERROR_INVALID_CLASS
dsamersoff
parents: 36511
diff changeset
   131
            for (i = 0; i < classCount; i++) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                jclass clazz = theClasses[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                jint status = classStatus(clazz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                char *candidate_signature = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                jint wanted =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                    (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY|
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                     JVMTI_CLASS_STATUS_PRIMITIVE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                /* We want prepared classes, primitives, and arrays only */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                if ((status & wanted) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                    continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                error = classSignature(clazz, &candidate_signature, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                if (error != JVMTI_ERROR_NONE) {
38334
ccb5cb0c8132 8143921: nsk/jdi/ObjectReference/waitingThreads/waitingthreads003 fails with JVMTI_ERROR_INVALID_CLASS
dsamersoff
parents: 36511
diff changeset
   146
                  // Clazz become invalid since the time we get the class list
ccb5cb0c8132 8143921: nsk/jdi/ObjectReference/waitingThreads/waitingthreads003 fails with JVMTI_ERROR_INVALID_CLASS
dsamersoff
parents: 36511
diff changeset
   147
                  // Skip this entry
ccb5cb0c8132 8143921: nsk/jdi/ObjectReference/waitingThreads/waitingthreads003 fails with JVMTI_ERROR_INVALID_CLASS
dsamersoff
parents: 36511
diff changeset
   148
                  if (error == JVMTI_ERROR_INVALID_CLASS) {
ccb5cb0c8132 8143921: nsk/jdi/ObjectReference/waitingThreads/waitingthreads003 fails with JVMTI_ERROR_INVALID_CLASS
dsamersoff
parents: 36511
diff changeset
   149
                    continue;
ccb5cb0c8132 8143921: nsk/jdi/ObjectReference/waitingThreads/waitingthreads003 fails with JVMTI_ERROR_INVALID_CLASS
dsamersoff
parents: 36511
diff changeset
   150
                  }
ccb5cb0c8132 8143921: nsk/jdi/ObjectReference/waitingThreads/waitingthreads003 fails with JVMTI_ERROR_INVALID_CLASS
dsamersoff
parents: 36511
diff changeset
   151
ccb5cb0c8132 8143921: nsk/jdi/ObjectReference/waitingThreads/waitingthreads003 fails with JVMTI_ERROR_INVALID_CLASS
dsamersoff
parents: 36511
diff changeset
   152
                  break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                if (strcmp(candidate_signature, signature) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                    /* Float interesting classes (those that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                     * are matching and are prepared) to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                     * beginning of the array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                    theClasses[i] = theClasses[matchCount];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                    theClasses[matchCount++] = clazz;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                jvmtiDeallocate(candidate_signature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            /* At this point matching prepared classes occupy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
             * indicies 0 thru matchCount-1 of theClasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            if ( error ==  JVMTI_ERROR_NONE ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                (void)outStream_writeInt(out, matchCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                for (; writtenCount < matchCount; writtenCount++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                    jclass clazz = theClasses[writtenCount];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                    jint status = classStatus(clazz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                    jbyte tag = referenceTypeTag(clazz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                    (void)outStream_writeByte(out, tag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                    (void)outStream_writeObjectRef(env, out, clazz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                    (void)outStream_writeInt(out, map2jdwpClassStatus(status));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                    /* No point in continuing if there's an error */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                    if (outStream_error(out)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            jvmtiDeallocate(theClasses);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        if ( error != JVMTI_ERROR_NONE ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            outStream_setError(out, map2jdwpError(error));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    } END_WITH_LOCAL_REFS(env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    jvmtiDeallocate(signature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
static jboolean
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   201
allModules(PacketInputStream *in, PacketOutputStream *out)
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   202
{
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   203
    JNIEnv *env;
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   204
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   205
    if (gdata->vmDead) {
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   206
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   207
        return JNI_TRUE;
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   208
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   209
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   210
    env = getEnv();
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   211
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   212
    WITH_LOCAL_REFS(env, 1) {
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   213
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   214
        jint count = 0;
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   215
        jint i = 0;
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   216
        jobject* modules = NULL;
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   217
        jvmtiError error = JVMTI_ERROR_NONE;
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   218
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   219
        error = JVMTI_FUNC_PTR(gdata->jvmti, GetAllModules) (gdata->jvmti, &count, &modules);
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   220
        if (error != JVMTI_ERROR_NONE) {
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   221
            outStream_setError(out, map2jdwpError(error));
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   222
        } else {
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   223
            (void)outStream_writeInt(out, count);
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   224
            for (i = 0; i < count; i++) {
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   225
                (void)outStream_writeModuleRef(env, out, modules[i]);
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   226
            }
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   227
            jvmtiDeallocate(modules);
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   228
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   229
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   230
    } END_WITH_LOCAL_REFS(env);
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   231
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   232
    return JNI_TRUE;
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   233
}
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   234
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   235
static jboolean
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
allClasses1(PacketInputStream *in, PacketOutputStream *out, int outputGenerics)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    JNIEnv *env;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    env = getEnv();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    WITH_LOCAL_REFS(env, 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        jint classCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        jclass *theClasses;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        jvmtiError error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        error = allLoadedClasses(&theClasses, &classCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        if ( error != JVMTI_ERROR_NONE ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            outStream_setError(out, map2jdwpError(error));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            /* Count classes in theClasses which are prepared */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
            int prepCount = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
            /* Count classes written to the JDWP connection */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            int writtenCount = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
            int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            for (i=0; i<classCount; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                jclass clazz = theClasses[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                jint status = classStatus(clazz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                jint wanted =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                    (JVMTI_CLASS_STATUS_PREPARED|JVMTI_CLASS_STATUS_ARRAY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                /* We want prepared classes and arrays only */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                if ((status & wanted) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
                    /* Float interesting classes (those that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                     * are prepared) to the beginning of the array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                    theClasses[i] = theClasses[prepCount];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                    theClasses[prepCount++] = clazz;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            /* At this point prepared classes occupy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
             * indicies 0 thru prepCount-1 of theClasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            (void)outStream_writeInt(out, prepCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
            for (; writtenCount < prepCount; writtenCount++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
                char *signature = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
                char *genericSignature = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                jclass clazz = theClasses[writtenCount];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                jint status = classStatus(clazz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                jbyte tag = referenceTypeTag(clazz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
                jvmtiError error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                error = classSignature(clazz, &signature, &genericSignature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
                if (error != JVMTI_ERROR_NONE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
                    outStream_setError(out, map2jdwpError(error));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
                (void)outStream_writeByte(out, tag);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                (void)outStream_writeObjectRef(env, out, clazz);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                (void)outStream_writeString(out, signature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                if (outputGenerics == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                    writeGenericSignature(out, genericSignature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                (void)outStream_writeInt(out, map2jdwpClassStatus(status));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                jvmtiDeallocate(signature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                if (genericSignature != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                  jvmtiDeallocate(genericSignature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                /* No point in continuing if there's an error */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                if (outStream_error(out)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            jvmtiDeallocate(theClasses);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    } END_WITH_LOCAL_REFS(env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
allClasses(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    return allClasses1(in, out, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
allClassesWithGeneric(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    return allClasses1(in, out, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
  /***********************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
instanceCounts(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    jint classCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    jclass *classes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    JNIEnv *env;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    int ii;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    classCount = inStream_readInt(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    if (classCount == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        (void)outStream_writeInt(out, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    if (classCount < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        outStream_setError(out, JDWP_ERROR(ILLEGAL_ARGUMENT));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    env = getEnv();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    classes = jvmtiAllocate(classCount * (int)sizeof(jclass));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    for (ii = 0; ii < classCount; ii++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        jdwpError errorCode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        classes[ii] = inStream_readClassRef(env, in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        errorCode = inStream_error(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        if (errorCode != JDWP_ERROR(NONE)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
             * A class could have been unloaded/gc'd so
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
             * if we get an error, just ignore it and keep
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
             * going.  An instanceCount of 0 will be returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
            if (errorCode == JDWP_ERROR(INVALID_OBJECT) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                errorCode == JDWP_ERROR(INVALID_CLASS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                inStream_clearError(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                classes[ii] = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            jvmtiDeallocate(classes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
            return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    WITH_LOCAL_REFS(env, 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        jlong      *counts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        jvmtiError error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        counts = jvmtiAllocate(classCount * (int)sizeof(jlong));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        /* Iterate over heap getting info on these classes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        error = classInstanceCounts(classCount, classes, counts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        if (error != JVMTI_ERROR_NONE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
            outStream_setError(out, map2jdwpError(error));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
            (void)outStream_writeInt(out, classCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
            for (ii = 0; ii < classCount; ii++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                (void)outStream_writeLong(out, counts[ii]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        jvmtiDeallocate(counts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    } END_WITH_LOCAL_REFS(env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    jvmtiDeallocate(classes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
redefineClasses(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    jvmtiClassDefinition *classDefs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    jboolean ok = JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
    jint classCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    jint i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    JNIEnv *env;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        /* quietly ignore */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    classCount = inStream_readInt(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    if ( classCount == 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    /*LINTED*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    classDefs = jvmtiAllocate(classCount*(int)sizeof(jvmtiClassDefinition));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    if (classDefs == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
    /*LINTED*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    (void)memset(classDefs, 0, classCount*sizeof(jvmtiClassDefinition));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    env = getEnv();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    for (i = 0; i < classCount; ++i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        int byteCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        unsigned char * bytes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        jclass clazz;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        clazz = inStream_readClassRef(env, in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        byteCount = inStream_readInt(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        if ( byteCount <= 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
            outStream_setError(out, JDWP_ERROR(INVALID_CLASS_FORMAT));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        bytes = (unsigned char *)jvmtiAllocate(byteCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        if (bytes == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
            outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        (void)inStream_readBytes(in, byteCount, (jbyte *)bytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
            ok = JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        classDefs[i].klass = clazz;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
        classDefs[i].class_byte_count = byteCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        classDefs[i].class_bytes = bytes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    if (ok == JNI_TRUE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        jvmtiError error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        error = JVMTI_FUNC_PTR(gdata->jvmti,RedefineClasses)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
                        (gdata->jvmti, classCount, classDefs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
        if (error != JVMTI_ERROR_NONE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
            outStream_setError(out, map2jdwpError(error));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
            /* zap our BP info */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
            for ( i = 0 ; i < classCount; i++ ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
                eventHandler_freeClassBreakpoints(classDefs[i].klass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
    /* free up allocated memory */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
    for ( i = 0 ; i < classCount; i++ ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
        if ( classDefs[i].class_bytes != NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
            jvmtiDeallocate((void*)classDefs[i].class_bytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
    jvmtiDeallocate(classDefs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
setDefaultStratum(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    char *stratumId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        /* quietly ignore */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
    stratumId = inStream_readString(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
    if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
    } else if (strcmp(stratumId, "") == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        stratumId = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    setGlobalStratumId(stratumId);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
getAllThreads(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
    JNIEnv *env;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    env = getEnv();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
    WITH_LOCAL_REFS(env, 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
        int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
        jint threadCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
        jthread *theThreads;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
        theThreads = allThreads(&threadCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
        if (theThreads == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
            outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
            /* Squish out all of the debugger-spawned threads */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
            threadCount = filterDebugThreads(theThreads, threadCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
            (void)outStream_writeInt(out, threadCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
            for (i = 0; i <threadCount; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
                (void)outStream_writeObjectRef(env, out, theThreads[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
            jvmtiDeallocate(theThreads);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
    } END_WITH_LOCAL_REFS(env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
topLevelThreadGroups(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
    JNIEnv *env;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    env = getEnv();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
    WITH_LOCAL_REFS(env, 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
        jvmtiError error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
        jint groupCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
        jthreadGroup *groups;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
        groups = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
        error = JVMTI_FUNC_PTR(gdata->jvmti,GetTopThreadGroups)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
                    (gdata->jvmti, &groupCount, &groups);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
        if (error != JVMTI_ERROR_NONE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
            outStream_setError(out, map2jdwpError(error));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
            int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
            (void)outStream_writeInt(out, groupCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
            for (i = 0; i < groupCount; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
                (void)outStream_writeObjectRef(env, out, groups[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
            jvmtiDeallocate(groups);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
    } END_WITH_LOCAL_REFS(env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
dispose(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
idSizes(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
    (void)outStream_writeInt(out, sizeof(jfieldID));    /* fields */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
    (void)outStream_writeInt(out, sizeof(jmethodID));   /* methods */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
    (void)outStream_writeInt(out, sizeof(jlong));       /* objects */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
    (void)outStream_writeInt(out, sizeof(jlong));       /* referent types */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
    (void)outStream_writeInt(out, sizeof(FrameID));    /* frames */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
suspend(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
    jvmtiError error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    error = threadControl_suspendAll();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
    if (error != JVMTI_ERROR_NONE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
        outStream_setError(out, map2jdwpError(error));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
resume(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
    jvmtiError error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
    error = threadControl_resumeAll();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
    if (error != JVMTI_ERROR_NONE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
        outStream_setError(out, map2jdwpError(error));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
doExit(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
    jint exitCode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
    exitCode = inStream_readInt(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
        /* quietly ignore */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
        return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
    /* We send the reply from here because we are about to exit. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
    if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
        outStream_setError(out, inStream_error(in));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
    outStream_sendReply(out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
    forceExit(exitCode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
    /* Shouldn't get here */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
    JDI_ASSERT(JNI_FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
    /* Shut up the compiler */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
    return JNI_FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
createString(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
    JNIEnv *env;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
    char *cstring;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
    cstring = inStream_readString(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
    if (cstring == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
        outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
    if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
    env = getEnv();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
    WITH_LOCAL_REFS(env, 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
        jstring string;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
        string = JNI_FUNC_PTR(env,NewStringUTF)(env, cstring);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
        if (JNI_FUNC_PTR(env,ExceptionOccurred)(env)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
            outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
            (void)outStream_writeObjectRef(env, out, string);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
    } END_WITH_LOCAL_REFS(env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
    jvmtiDeallocate(cstring);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
capabilities(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
    jvmtiCapabilities caps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
    jvmtiError error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
    error = jvmtiGetCapabilities(&caps);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
    if (error != JVMTI_ERROR_NONE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
        outStream_setError(out, map2jdwpError(error));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
    (void)outStream_writeBoolean(out, (jboolean)caps.can_generate_field_modification_events);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
    (void)outStream_writeBoolean(out, (jboolean)caps.can_generate_field_access_events);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_bytecodes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_synthetic_attribute);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_owned_monitor_info);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_current_contended_monitor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_monitor_info);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
capabilitiesNew(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
    jvmtiCapabilities caps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
    jvmtiError error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
        outStream_setError(out, JDWP_ERROR(VM_DEAD));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
    error = jvmtiGetCapabilities(&caps);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
    if (error != JVMTI_ERROR_NONE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
        outStream_setError(out, map2jdwpError(error));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
    (void)outStream_writeBoolean(out, (jboolean)caps.can_generate_field_modification_events);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
    (void)outStream_writeBoolean(out, (jboolean)caps.can_generate_field_access_events);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_bytecodes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_synthetic_attribute);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_owned_monitor_info);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_current_contended_monitor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_monitor_info);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
    /* new since JDWP version 1.4 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
    (void)outStream_writeBoolean(out, (jboolean)caps.can_redefine_classes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE /* can_add_method */ );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE /* can_unrestrictedly_redefine_classes */ );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
    /* 11: canPopFrames */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
    (void)outStream_writeBoolean(out, (jboolean)caps.can_pop_frame);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
    /* 12: canUseInstanceFilters */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
    (void)outStream_writeBoolean(out, (jboolean)JNI_TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
    /* 13: canGetSourceDebugExtension */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_source_debug_extension);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
    /* 14: canRequestVMDeathEvent */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
    (void)outStream_writeBoolean(out, (jboolean)JNI_TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
    /* 15: canSetDefaultStratum */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
    (void)outStream_writeBoolean(out, (jboolean)JNI_TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
    /* 16: canGetInstanceInfo */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
    (void)outStream_writeBoolean(out, (jboolean)caps.can_tag_objects);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
    /* 17: canRequestMonitorEvents */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
    (void)outStream_writeBoolean(out, (jboolean)caps.can_generate_monitor_events);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
    /* 18: canGetMonitorFrameInfo */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_owned_monitor_stack_depth_info);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
    /* remaining reserved */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 19 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
    /* 20 Can get constant pool information */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
    (void)outStream_writeBoolean(out, (jboolean)caps.can_get_constant_pool);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
    /* 21 Can force early return */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
    (void)outStream_writeBoolean(out, (jboolean)caps.can_force_early_return);
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   793
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 22 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 23 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 24 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 25 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 26 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 27 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 28 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 29 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 30 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 31 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
    (void)outStream_writeBoolean(out, (jboolean)JNI_FALSE); /* 32 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
static int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
countPaths(char *string) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
    int cnt = 1; /* always have one */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
    char *pos = string;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
    char *ps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
    ps = gdata->property_path_separator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
    if ( ps == NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
        ps = ";";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
    while ((pos = strchr(pos, ps[0])) != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
        ++cnt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
        ++pos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
    return cnt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
writePaths(PacketOutputStream *out, char *string) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
    char *pos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
    char *ps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
    char *buf;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
    int   npaths;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
    int   i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
    buf = jvmtiAllocate((int)strlen(string)+1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
    npaths = countPaths(string);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
    (void)outStream_writeInt(out, npaths);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
    ps = gdata->property_path_separator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
    if ( ps == NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
        ps = ";";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
    pos = string;
48235
8db54e2c453b 8192978: Missing checks and small fixes in jdwp library
clanger
parents: 47216
diff changeset
   844
    for ( i = 0 ; i < npaths && pos != NULL; i++ ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
        char *psPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
        int   plen;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
        psPos = strchr(pos, ps[0]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
        if ( psPos == NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
            plen = (int)strlen(pos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
            plen = (int)(psPos-pos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
            psPos++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
        (void)memcpy(buf, pos, plen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
        buf[plen] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
        (void)outStream_writeString(out, buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
        pos = psPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
    jvmtiDeallocate(buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
classPaths(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
    char *ud;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
    char *cp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
    ud = gdata->property_user_dir;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
    if ( ud == NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
        ud = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
    cp = gdata->property_java_class_path;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
    if ( cp == NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
        cp = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
    (void)outStream_writeString(out, ud);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
    writePaths(out, cp);
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   880
    (void)outStream_writeInt(out, 0); // no bootclasspath
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
disposeObjects(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
    int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
    int refCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
    jlong id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
    int requestCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
    JNIEnv *env;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
    if (gdata->vmDead) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
        /* quietly ignore */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
    requestCount = inStream_readInt(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
    if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
        return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
    env = getEnv();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
    for (i = 0; i < requestCount; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
        id = inStream_readObjectID(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
        refCount = inStream_readInt(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
        if (inStream_error(in)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
            return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
        commonRef_releaseMultiple(env, id, refCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
holdEvents(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
    eventHelper_holdEvents();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
static jboolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
releaseEvents(PacketInputStream *in, PacketOutputStream *out)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
    eventHelper_releaseEvents();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
    return JNI_TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   930
void *VirtualMachine_Cmds[] = { (void *)22
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
    ,(void *)version
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
    ,(void *)classesForSignature
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
    ,(void *)allClasses
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
    ,(void *)getAllThreads
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
    ,(void *)topLevelThreadGroups
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
    ,(void *)dispose
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
    ,(void *)idSizes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
    ,(void *)suspend
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
    ,(void *)resume
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
    ,(void *)doExit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
    ,(void *)createString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
    ,(void *)capabilities
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
    ,(void *)classPaths
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
    ,(void *)disposeObjects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
    ,(void *)holdEvents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
    ,(void *)releaseEvents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
    ,(void *)capabilitiesNew
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
    ,(void *)redefineClasses
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
    ,(void *)setDefaultStratum
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
    ,(void *)allClassesWithGeneric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
    ,(void *)instanceCounts
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   952
    ,(void *)allModules
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
};