aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Sanglard <sanglardf@google.com>2022-12-21 18:44:13 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-12-21 18:44:13 +0000
commit7a949c3bcd128c3c11436cc8b8c90482a495cab0 (patch)
treeff90a9083e7ecc2be74d5699f768a28a29cb3d25
parent63dd7732bcd264d07a97ae59a58570dd99246680 (diff)
parent1180666a3dac61b7a31c93e54243a82d806e5f6f (diff)
downloadoj-libjdwp-7a949c3bcd128c3c11436cc8b8c90482a495cab0.tar.gz
Merge "Remove 1.3s "Waiting for Debugger" delay"main-16k-with-phones
-rw-r--r--src/share/back/vmDebug.c18
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, &currentThread);
+ 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,