diff options
Diffstat (limited to 'src/share/back/vmDebug.c')
-rw-r--r-- | src/share/back/vmDebug.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/share/back/vmDebug.c b/src/share/back/vmDebug.c index 4b51ee295..010cb8a3b 100644 --- a/src/share/back/vmDebug.c +++ b/src/share/back/vmDebug.c @@ -31,6 +31,8 @@ #include "debugLoop.h" #include "transport.h" #include "util.h" +#include "eventHelper.h" +#include "threadControl.h" static _Atomic(jlong) lastDebuggerActivity = ATOMIC_VAR_INIT(0LL); static _Atomic(jboolean) hasSeenDebuggerActivity = ATOMIC_VAR_INIT(JNI_FALSE); @@ -70,6 +72,14 @@ VMDebug_isDebuggerConnected(JNIEnv* env, jclass klass) return isDebuggerConnected(); } +static void JNICALL +VMDebug_suspendAllAndSendVmStart(JNIEnv* env, jclass klass) +{ + jthread currentThread; + JVMTI_FUNC_PTR(gdata->jvmti, GetCurrentThread)(gdata->jvmti, ¤tThread); + eventHelper_reportVMInit(getEnv(), 0, currentThread, JDWP_SUSPEND_POLICY(ALL)); +} + static jboolean JNICALL VMDebug_isDebuggingEnabled(JNIEnv* env, jclass klass) { @@ -115,9 +125,9 @@ vmDebug_initalize(JNIEnv* env) goto finish; } - JNINativeMethod methods[3]; + JNINativeMethod methods[4]; - // Take over the implementation of these three functions. + // Take over the implementation of these functions. methods[0].name = "lastDebuggerActivity"; methods[0].signature = "()J"; methods[0].fnPtr = (void*)VMDebug_lastDebuggerActivity; @@ -130,6 +140,10 @@ vmDebug_initalize(JNIEnv* env) methods[2].signature = "()Z"; methods[2].fnPtr = (void*)VMDebug_isDebuggerConnected; + methods[3].name = "suspendAllAndSendVmStart"; + methods[3].signature = "()V"; + methods[3].fnPtr = (void*)VMDebug_suspendAllAndSendVmStart; + jint res = JNI_FUNC_PTR(env,RegisterNatives)(env, vmdebug_class, methods, |