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