Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions src/jdk.hotspot.agent/macosx/native/libsaproc/MacosxDebuggerLocal.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
#endif

/*
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
* Class: sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal
* Method: init0
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_init0(JNIEnv *env, jclass cls) {
Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_init0(JNIEnv *env, jclass cls) {
symbolicatorID = (*env)->GetFieldID(env, cls, "symbolicator", "J");
CHECK_EXCEPTION;
taskID = (*env)->GetFieldID(env, cls, "task", "J");
Expand Down Expand Up @@ -215,7 +215,7 @@ static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
init_libproc(getenv("LIBSAPROC_DEBUG") != NULL);
}

JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getAddressSize
JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_getAddressSize
(JNIEnv *env, jclass cls)
{
#ifdef _LP64
Expand All @@ -225,7 +225,7 @@ static void throw_new_debugger_exception(JNIEnv* env, const char* errMsg) {
#endif
}

/** called by Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0 */
/** called by Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_lookupByName0 */
jlong lookupByNameIncore(
JNIEnv *env, struct ps_prochandle *ph, jobject this_obj, jstring objectName, jstring symbolName)
{
Expand Down Expand Up @@ -289,12 +289,12 @@ jlong lookupByNameIncore(
}

/*
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
* Class: sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal
* Method: lookupByName0
* Signature: (Ljava/lang/String;Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByName0(
Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_lookupByName0(
JNIEnv *env, jobject this_obj,
jstring objectName, jstring symbolName)
{
Expand Down Expand Up @@ -324,11 +324,11 @@ jlong lookupByNameIncore(
}

/*
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
* Class: sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal
* Method: lookupByAddress0
* Signature: (J)Lsun/jvm/hotspot/debugger/cdbg/ClosestSymbol;
*/
JNIEXPORT jobject JNICALL Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_lookupByAddress0
JNIEXPORT jobject JNICALL Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_lookupByAddress0
(JNIEnv *env, jobject this_obj, jlong addr) {
uintptr_t offset;
const char* sym = NULL;
Expand All @@ -346,7 +346,7 @@ jlong lookupByNameIncore(
return 0;
}

/** called from Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0 */
/** called from Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_readBytesFromProcess0 */
jbyteArray readBytesFromCore(
JNIEnv *env, struct ps_prochandle *ph, jobject this_obj, jlong addr, jlong numBytes)
{
Expand All @@ -366,12 +366,12 @@ jbyteArray readBytesFromCore(
}

/*
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
* Class: sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal
* Method: readBytesFromProcess0
* Signature: (JJ)Lsun/jvm/hotspot/debugger/ReadResult;
*/
JNIEXPORT jbyteArray JNICALL
Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_readBytesFromProcess0(
Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_readBytesFromProcess0(
JNIEnv *env, jobject this_obj,
jlong addr, jlong numBytes)
{
Expand Down Expand Up @@ -463,7 +463,7 @@ jbyteArray readBytesFromCore(
* from Threads which store all java threads information when they are created. Here we can identify
* them as java threads by checking if a thread's rsp or rbp within a java thread's stack.
* Note Macosx uses unique_thread_id which is different from other platforms though printed ids
* are still pthread id. Function BsdDebuggerLocal.getJavaThreadsInfo returns an array of long
* are still pthread id. Function MacosxDebuggerLocal.getJavaThreadsInfo returns an array of long
* integers to host all java threads' id, stack_start, stack_end as:
* [uid0, stack_start0, stack_end0, uid1, stack_start1, stack_end1, ...]
*
Expand Down Expand Up @@ -514,7 +514,7 @@ bool fill_java_threads(JNIEnv* env, jobject this_obj, struct ps_prochandle* ph)
}

/* For core file only, called from
* Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0
* Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_getThreadIntegerRegisterSet0
*/
jlongArray getThreadIntegerRegisterSetFromCore(JNIEnv *env, jobject this_obj, long lwp_id, struct ps_prochandle* ph) {
if (!_threads_filled) {
Expand Down Expand Up @@ -677,12 +677,12 @@ jlongArray getThreadIntegerRegisterSetFromCore(JNIEnv *env, jobject this_obj, lo


/*
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
* Class: sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal
* Method: getThreadIntegerRegisterSet0
* Signature: (J)[J
*/
JNIEXPORT jlongArray JNICALL
Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_getThreadIntegerRegisterSet0(
Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_getThreadIntegerRegisterSet0(
JNIEnv *env, jobject this_obj,
jlong thread_id)
{
Expand Down Expand Up @@ -809,7 +809,7 @@ jlongArray getThreadIntegerRegisterSetFromCore(JNIEnv *env, jobject this_obj, lo
}

/*
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
* Class: sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal
* Method: translateTID0
* Signature: (I)I
*/
Expand Down Expand Up @@ -954,12 +954,12 @@ static int wait_for_exception() {
}

/*
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
* Class: sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal
* Method: attach0
* Signature: (I)V
*/
JNIEXPORT void JNICALL
Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__I(
Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_attach0__I(
JNIEnv *env, jobject this_obj, jint jpid)
{
print_debug("attach0 called for jpid=%d\n", (int)jpid);
Expand Down Expand Up @@ -1089,7 +1089,7 @@ static int wait_for_exception() {
}

/** For core file,
called from Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2 */
called from Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2 */
static void fillLoadObjects(JNIEnv* env, jobject this_obj, struct ps_prochandle* ph) {
int n = 0, i = 0;
jobject loadObjectList;
Expand Down Expand Up @@ -1120,12 +1120,12 @@ static void fillLoadObjects(JNIEnv* env, jobject this_obj, struct ps_prochandle*
}

/*
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
* Class: sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal
* Method: attach0
* Signature: (Ljava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL
Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2(
Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_attach0__Ljava_lang_String_2Ljava_lang_String_2(
JNIEnv *env, jobject this_obj, jstring execName, jstring coreName)
{
const char *execName_cstr;
Expand Down Expand Up @@ -1168,12 +1168,12 @@ static void detach_cleanup(task_t gTask, JNIEnv *env, jobject this_obj, bool thr
}

/*
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
* Class: sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal
* Method: detach0
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal_detach0(
Java_sun_jvm_hotspot_debugger_macosx_MacosxDebuggerLocal_detach0(
JNIEnv *env, jobject this_obj)
{
print_debug("detach0 called\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
import sun.jvm.hotspot.debugger.MachineDescriptionAArch64;
import sun.jvm.hotspot.debugger.MachineDescriptionRISCV64;
import sun.jvm.hotspot.debugger.NoSuchSymbolException;
import sun.jvm.hotspot.debugger.bsd.BsdDebuggerLocal;
import sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal;
import sun.jvm.hotspot.debugger.macosx.MacosxDebuggerLocal;
import sun.jvm.hotspot.debugger.remote.RemoteDebugger;
import sun.jvm.hotspot.debugger.remote.RemoteDebuggerClient;
import sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer;
Expand Down Expand Up @@ -372,8 +372,6 @@ private void setupDebugger() {
setupDebuggerWin32();
} else if (os.equals("linux")) {
setupDebuggerLinux();
} else if (os.equals("bsd")) {
setupDebuggerBsd();
} else if (os.equals("darwin")) {
setupDebuggerDarwin();
} else {
Expand Down Expand Up @@ -417,13 +415,9 @@ private void setupVM() {
db = new HotSpotTypeDataBase(machDesc,
new LinuxVtblAccess(debugger, jvmLibNames),
debugger, jvmLibNames);
} else if (os.equals("bsd")) {
db = new HotSpotTypeDataBase(machDesc,
new BsdVtblAccess(debugger, jvmLibNames),
debugger, jvmLibNames);
} else if (os.equals("darwin")) {
db = new HotSpotTypeDataBase(machDesc,
new BsdVtblAccess(debugger, jvmLibNames),
new MacosxVtblAccess(debugger, jvmLibNames),
debugger, jvmLibNames);
} else {
throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess yet)");
Expand Down Expand Up @@ -505,8 +499,6 @@ private void setupJVMLibNames(String os) {
setupJVMLibNamesWin32();
} else if (os.equals("linux")) {
setupJVMLibNamesLinux();
} else if (os.equals("bsd")) {
setupJVMLibNamesBsd();
} else if (os.equals("darwin")) {
setupJVMLibNamesDarwin();
} else {
Expand Down Expand Up @@ -580,29 +572,6 @@ private void setupJVMLibNamesLinux() {
jvmLibNames = new String[] { "libjvm.so" };
}

//
// BSD
//

private void setupDebuggerBsd() {
setupJVMLibNamesBsd();

if (cpu.equals("amd64") || cpu.equals("x86_64")) {
machDesc = new MachineDescriptionAMD64();
} else {
throw new DebuggerException("BSD only supported on x86_64. Current arch: " + cpu);
}

BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer);
debugger = dbg;

attachDebugger();
}

private void setupJVMLibNamesBsd() {
jvmLibNames = new String[] { "libjvm.so" };
}

//
// Darwin
//
Expand All @@ -618,7 +587,7 @@ private void setupDebuggerDarwin() {
throw new DebuggerException("Darwin only supported on x86_64/aarch64. Current arch: " + cpu);
}

BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer);
MacosxDebuggerLocal dbg = new MacosxDebuggerLocal(machDesc, !isServer);
debugger = dbg;

attachDebugger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
import sun.jvm.hotspot.types.*;
import sun.jvm.hotspot.types.basic.*;

public class BsdVtblAccess extends BasicVtblAccess {
public class MacosxVtblAccess extends BasicVtblAccess {
private String vt;

public BsdVtblAccess(SymbolLookup symbolLookup,
public MacosxVtblAccess(SymbolLookup symbolLookup,
String[] dllNames) {
super(symbolLookup, dllNames);
boolean oldVT = false;
Expand Down
Loading