src/jdk.jdwp.agent/share/native/libjdwp/ReferenceTypeImpl.c

Print this page


   1 /*
   2  * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  92     JNIEnv *env;
  93 
  94     env = getEnv();
  95 
  96     clazz = inStream_readClassRef(env, in);
  97     if (inStream_error(in)) {
  98         return JNI_TRUE;
  99     }
 100 
 101     error = classLoader(clazz, &loader);
 102     if (error != JVMTI_ERROR_NONE) {
 103         outStream_setError(out, map2jdwpError(error));
 104         return JNI_TRUE;
 105     }
 106 
 107     (void)outStream_writeObjectRef(env, out, loader);
 108     return JNI_TRUE;
 109 }
 110 
 111 static jboolean




















 112 modifiers(PacketInputStream *in, PacketOutputStream *out)
 113 {
 114     jint modifiers;
 115     jclass clazz;
 116     jvmtiError error;
 117 
 118     clazz = inStream_readClassRef(getEnv(), in);
 119     if (inStream_error(in)) {
 120         return JNI_TRUE;
 121     }
 122 
 123     error = JVMTI_FUNC_PTR(gdata->jvmti,GetClassModifiers)
 124                 (gdata->jvmti, clazz, &modifiers);
 125     if (error != JVMTI_ERROR_NONE) {
 126         outStream_setError(out, map2jdwpError(error));
 127         return JNI_TRUE;
 128     }
 129 
 130     (void)outStream_writeInt(out, modifiers);
 131 


 588     jclass clazz;
 589     JNIEnv *env;
 590 
 591     env = getEnv();
 592     clazz = inStream_readClassRef(env, in);
 593     if (inStream_error(in)) {
 594         return JNI_TRUE;
 595     }
 596 
 597     /*
 598      * In our implementation, the reference type id is the same as the
 599      * class object id, so we bounce it right back.
 600      *
 601      */
 602 
 603     (void)outStream_writeObjectRef(env, out, clazz);
 604 
 605     return JNI_TRUE;
 606 }
 607 
 608 void *ReferenceType_Cmds[] = { (void *)18
 609     ,(void *)signature
 610     ,(void *)getClassLoader
 611     ,(void *)modifiers
 612     ,(void *)fields
 613     ,(void *)methods
 614     ,(void *)getValues
 615     ,(void *)sourceFile
 616     ,(void *)nestedTypes
 617     ,(void *)getClassStatus
 618     ,(void *)interfaces
 619     ,(void *)classObject
 620     ,(void *)sourceDebugExtension
 621     ,(void *)signatureWithGeneric
 622     ,(void *)fieldsWithGeneric
 623     ,(void *)methodsWithGeneric
 624     ,(void *)instances
 625     ,(void *)getClassVersion
 626     ,(void *)getConstantPool

 627 };
   1 /*
   2  * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  92     JNIEnv *env;
  93 
  94     env = getEnv();
  95 
  96     clazz = inStream_readClassRef(env, in);
  97     if (inStream_error(in)) {
  98         return JNI_TRUE;
  99     }
 100 
 101     error = classLoader(clazz, &loader);
 102     if (error != JVMTI_ERROR_NONE) {
 103         outStream_setError(out, map2jdwpError(error));
 104         return JNI_TRUE;
 105     }
 106 
 107     (void)outStream_writeObjectRef(env, out, loader);
 108     return JNI_TRUE;
 109 }
 110 
 111 static jboolean
 112 getModule(PacketInputStream *in, PacketOutputStream *out)
 113 {
 114     jobject clazz;
 115     jobject module;
 116     JNIEnv *env;
 117 
 118     env = getEnv();
 119 
 120     clazz = inStream_readClassRef(env, in);
 121     if (inStream_error(in)) {
 122         return JNI_TRUE;
 123     }
 124 
 125     module = JNI_FUNC_PTR(env,GetModule)(env, clazz);
 126 
 127     (void)outStream_writeModuleRef(env, out, module);
 128     return JNI_TRUE;
 129 }
 130 
 131 static jboolean
 132 modifiers(PacketInputStream *in, PacketOutputStream *out)
 133 {
 134     jint modifiers;
 135     jclass clazz;
 136     jvmtiError error;
 137 
 138     clazz = inStream_readClassRef(getEnv(), in);
 139     if (inStream_error(in)) {
 140         return JNI_TRUE;
 141     }
 142 
 143     error = JVMTI_FUNC_PTR(gdata->jvmti,GetClassModifiers)
 144                 (gdata->jvmti, clazz, &modifiers);
 145     if (error != JVMTI_ERROR_NONE) {
 146         outStream_setError(out, map2jdwpError(error));
 147         return JNI_TRUE;
 148     }
 149 
 150     (void)outStream_writeInt(out, modifiers);
 151 


 608     jclass clazz;
 609     JNIEnv *env;
 610 
 611     env = getEnv();
 612     clazz = inStream_readClassRef(env, in);
 613     if (inStream_error(in)) {
 614         return JNI_TRUE;
 615     }
 616 
 617     /*
 618      * In our implementation, the reference type id is the same as the
 619      * class object id, so we bounce it right back.
 620      *
 621      */
 622 
 623     (void)outStream_writeObjectRef(env, out, clazz);
 624 
 625     return JNI_TRUE;
 626 }
 627 
 628 void *ReferenceType_Cmds[] = { (void *)19
 629     ,(void *)signature
 630     ,(void *)getClassLoader
 631     ,(void *)modifiers
 632     ,(void *)fields
 633     ,(void *)methods
 634     ,(void *)getValues
 635     ,(void *)sourceFile
 636     ,(void *)nestedTypes
 637     ,(void *)getClassStatus
 638     ,(void *)interfaces
 639     ,(void *)classObject
 640     ,(void *)sourceDebugExtension
 641     ,(void *)signatureWithGeneric
 642     ,(void *)fieldsWithGeneric
 643     ,(void *)methodsWithGeneric
 644     ,(void *)instances
 645     ,(void *)getClassVersion
 646     ,(void *)getConstantPool
 647     ,(void *)getModule
 648 };