hotspot/src/jdk.hotspot.agent/macosx/native/libsaproc/StubDebuggerLocal.c
changeset 35217 ce4b5303a813
parent 10565 dc90c239f4ec
equal deleted inserted replaced
35216:71c463a17b3b 35217:ce4b5303a813
       
     1 /*
       
     2  * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  *
       
    23  */
       
    24 
       
    25 #include <stdlib.h>
       
    26 #include <jni.h>
       
    27 
       
    28 #define CHECK_EXCEPTION_(value) if ((*env)->ExceptionOccurred(env)) { return value; }
       
    29 #define CHECK_EXCEPTION if ((*env)->ExceptionOccurred(env)) { return;}
       
    30 #define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; }
       
    31 #define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;}
       
    32 
       
    33 static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
       
    34   (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg);
       
    35 }
       
    36 
       
    37 /*
       
    38  * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
       
    39  * Method:    init0
       
    40  * Signature: ()V
       
    41  */
       
    42 JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0
       
    43   (JNIEnv *env, jclass cls) {
       
    44 }
       
    45 
       
    46 JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getAddressSize
       
    47   (JNIEnv *env, jclass cls)
       
    48 {
       
    49 #ifdef _LP64
       
    50  return 8;
       
    51 #else
       
    52  return 4;
       
    53 #endif
       
    54 
       
    55 }
       
    56 
       
    57 /*
       
    58  * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
       
    59  * Method:    attach0
       
    60  * Signature: (I)V
       
    61  */
       
    62 JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I
       
    63   (JNIEnv *env, jobject this_obj, jint jpid) {
       
    64 
       
    65   THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process");
       
    66 }
       
    67 
       
    68 /*
       
    69  * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
       
    70  * Method:    attach0
       
    71  * Signature: (Ljava/lang/String;Ljava/lang/String;)V
       
    72  */
       
    73 JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2
       
    74   (JNIEnv *env, jobject this_obj, jstring execName, jstring coreName) {
       
    75   THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the core file");
       
    76 }
       
    77 
       
    78 /*
       
    79  * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
       
    80  * Method:    detach0
       
    81  * Signature: ()V
       
    82  */
       
    83 JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0
       
    84   (JNIEnv *env, jobject this_obj) {
       
    85 }
       
    86 
       
    87 /*
       
    88  * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
       
    89  * Method:    lookupByName0
       
    90  * Signature: (Ljava/lang/String;Ljava/lang/String;)J
       
    91  */
       
    92 JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0
       
    93   (JNIEnv *env, jobject this_obj, jstring objectName, jstring symbolName) {
       
    94   return 0;
       
    95 }
       
    96 
       
    97 /*
       
    98  * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
       
    99  * Method:    lookupByAddress0
       
   100  * Signature: (J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol;
       
   101  */
       
   102 JNIEXPORT jobject JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByAddress0
       
   103   (JNIEnv *env, jobject this_obj, jlong addr) {
       
   104   return 0;
       
   105 }
       
   106 
       
   107 /*
       
   108  * Class:     sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
       
   109  * Method:    readBytesFromProcess0
       
   110  * Signature: (JJ)Lsun/jvm/hotspot/debugger/ReadResult;
       
   111  */
       
   112 JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0
       
   113   (JNIEnv *env, jobject this_obj, jlong addr, jlong numBytes) {
       
   114   return 0;
       
   115 }
       
   116 
       
   117 JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0
       
   118   (JNIEnv *env, jobject this_obj, jint lwp_id) {
       
   119   return 0;
       
   120 }