1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/agent/src/os/bsd/StubDebuggerLocal.c Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,120 @@ 1.4 +/* 1.5 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#include <stdlib.h> 1.29 +#include <jni.h> 1.30 + 1.31 +#define CHECK_EXCEPTION_(value) if ((*env)->ExceptionOccurred(env)) { return value; } 1.32 +#define CHECK_EXCEPTION if ((*env)->ExceptionOccurred(env)) { return;} 1.33 +#define THROW_NEW_DEBUGGER_EXCEPTION_(str, value) { throw_new_debugger_exception(env, str); return value; } 1.34 +#define THROW_NEW_DEBUGGER_EXCEPTION(str) { throw_new_debugger_exception(env, str); return;} 1.35 + 1.36 +static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) { 1.37 + (*env)->ThrowNew(env, (*env)->FindClass(env, "sun/jvm/hotspot/debugger/DebuggerException"), errMsg); 1.38 +} 1.39 + 1.40 +/* 1.41 + * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal 1.42 + * Method: init0 1.43 + * Signature: ()V 1.44 + */ 1.45 +JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0 1.46 + (JNIEnv *env, jclass cls) { 1.47 +} 1.48 + 1.49 +JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getAddressSize 1.50 + (JNIEnv *env, jclass cls) 1.51 +{ 1.52 +#ifdef _LP64 1.53 + return 8; 1.54 +#else 1.55 + return 4; 1.56 +#endif 1.57 + 1.58 +} 1.59 + 1.60 +/* 1.61 + * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal 1.62 + * Method: attach0 1.63 + * Signature: (I)V 1.64 + */ 1.65 +JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I 1.66 + (JNIEnv *env, jobject this_obj, jint jpid) { 1.67 + 1.68 + THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process"); 1.69 +} 1.70 + 1.71 +/* 1.72 + * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal 1.73 + * Method: attach0 1.74 + * Signature: (Ljava/lang/String;Ljava/lang/String;)V 1.75 + */ 1.76 +JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2 1.77 + (JNIEnv *env, jobject this_obj, jstring execName, jstring coreName) { 1.78 + THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the core file"); 1.79 +} 1.80 + 1.81 +/* 1.82 + * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal 1.83 + * Method: detach0 1.84 + * Signature: ()V 1.85 + */ 1.86 +JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0 1.87 + (JNIEnv *env, jobject this_obj) { 1.88 +} 1.89 + 1.90 +/* 1.91 + * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal 1.92 + * Method: lookupByName0 1.93 + * Signature: (Ljava/lang/String;Ljava/lang/String;)J 1.94 + */ 1.95 +JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0 1.96 + (JNIEnv *env, jobject this_obj, jstring objectName, jstring symbolName) { 1.97 + return 0; 1.98 +} 1.99 + 1.100 +/* 1.101 + * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal 1.102 + * Method: lookupByAddress0 1.103 + * Signature: (J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol; 1.104 + */ 1.105 +JNIEXPORT jobject JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByAddress0 1.106 + (JNIEnv *env, jobject this_obj, jlong addr) { 1.107 + return 0; 1.108 +} 1.109 + 1.110 +/* 1.111 + * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal 1.112 + * Method: readBytesFromProcess0 1.113 + * Signature: (JJ)Lsun/jvm/hotspot/debugger/ReadResult; 1.114 + */ 1.115 +JNIEXPORT jbyteArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0 1.116 + (JNIEnv *env, jobject this_obj, jlong addr, jlong numBytes) { 1.117 + return 0; 1.118 +} 1.119 + 1.120 +JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0 1.121 + (JNIEnv *env, jobject this_obj, jint lwp_id) { 1.122 + return 0; 1.123 +}