public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFA] Add JDWP VM_INIT JVMTI callback
@ 2007-01-16  6:40 Keith Seitz
  2007-01-16 19:38 ` Tom Tromey
  2007-01-19  0:00 ` Marco Trudel
  0 siblings, 2 replies; 18+ messages in thread
From: Keith Seitz @ 2007-01-16  6:40 UTC (permalink / raw)
  To: Java Patch List

[-- Attachment #1: Type: text/plain, Size: 571 bytes --]

Hi,

This patch adds a JVMTI VM_INIT callback to be used by the JDWP code. 
Currently this function simply sends the JDWP VM_INIT event 
notification, but later it will do install additional JVMTI callbacks 
for all the various JDWP event notifications.

Comments/questions/concerns?
Keith

ChangeLog
2007-01-15  Keith Seitz  <keiths@redhat.com>

         * gnu/classpath/jdwp/natVMVirtualMachine.cc (DEFINE_CALLBACK): 
New macro.
         (ENABLE_EVENT): New macro.
         (initialize): Define and enable JVMTI VM_INIT callback.
         (jdwpVMInitCB): New function.

[-- Attachment #2: vminitcb.patch --]
[-- Type: text/x-patch, Size: 2008 bytes --]

Index: gnu/classpath/jdwp/natVMVirtualMachine.cc
===================================================================
--- gnu/classpath/jdwp/natVMVirtualMachine.cc	(revision 120805)
+++ gnu/classpath/jdwp/natVMVirtualMachine.cc	(working copy)
@@ -24,10 +24,12 @@
 #include <java/util/Hashtable.h>
 #include <java/util/Iterator.h>
 
+#include <gnu/classpath/jdwp/Jdwp.h>
 #include <gnu/classpath/jdwp/VMFrame.h>
 #include <gnu/classpath/jdwp/VMMethod.h>
 #include <gnu/classpath/jdwp/VMVirtualMachine.h>
 #include <gnu/classpath/jdwp/event/EventRequest.h>
+#include <gnu/classpath/jdwp/event/VmInitEvent.h>
 #include <gnu/classpath/jdwp/exception/JdwpInternalErrorException.h>
 #include <gnu/classpath/jdwp/util/MethodResult.h>
 
@@ -35,6 +37,13 @@
 using namespace gnu::classpath::jdwp::event;
 using namespace gnu::classpath::jdwp::util;
 
+// Forward declarations
+static void jdwpVMInitCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread);
+
+#define DEFINE_CALLBACK(Cb,Event) Cb.Event = jdwp ## Event ## CB
+#define ENABLE_EVENT(Event,Thread)					\
+  _jdwp_jvmtiEnv->SetEventNotificationMode (JVMTI_ENABLE,		\
+					    JVMTI_EVENT_ ## Event, Thread)
 // JVMTI environment
 static jvmtiEnv *_jdwp_jvmtiEnv;
 
@@ -44,6 +53,12 @@
   _jdwp_suspend_counts = new ::java::util::Hashtable ();
   JavaVM *vm = _Jv_GetJavaVM ();
   vm->GetEnv (reinterpret_cast<void **> (&_jdwp_jvmtiEnv), JVMTI_VERSION_1_0);
+
+  // Wait for VM_INIT to do more initialization
+  jvmtiEventCallbacks callbacks;
+  DEFINE_CALLBACK (callbacks, VMInit);
+  _jdwp_jvmtiEnv->SetEventCallbacks (&callbacks, sizeof (callbacks));
+  ENABLE_EVENT (VM_INIT, NULL);
 }
 
 void
@@ -343,3 +358,13 @@
 {
   return NULL;
 }
+
+static void
+jdwpVMInitCB (MAYBE_UNUSED jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env,
+	      jthread thread)
+{
+  // Send JDWP VMInit
+  using namespace gnu::classpath::jdwp::event;
+  Thread *init_thread = reinterpret_cast<Thread *> (thread);
+  gnu::classpath::jdwp::Jdwp::notify (new VmInitEvent (init_thread));
+}

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2007-01-20 18:33 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-16  6:40 [RFA] Add JDWP VM_INIT JVMTI callback Keith Seitz
2007-01-16 19:38 ` Tom Tromey
2007-01-16 19:54   ` Keith Seitz
2007-01-19  0:00 ` Marco Trudel
2007-01-19  0:03   ` Keith Seitz
2007-01-19 15:37     ` Tom Tromey
2007-01-19 17:56       ` Marco Trudel
2007-01-19 18:11         ` David Daney
2007-01-19 18:23           ` Marco Trudel
2007-01-19 18:35             ` David Daney
     [not found]         ` <45B108EF.2070601@redhat.com>
2007-01-19 18:18           ` Marco Trudel
2007-01-20  0:02         ` Tom Tromey
2007-01-20 12:28           ` Marco Trudel
2007-01-20 18:33             ` Tom Tromey
2007-01-19  0:05   ` Andrew Haley
2007-01-19  1:31     ` Keith Seitz
2007-01-19 15:40       ` Tom Tromey
2007-01-19 17:27         ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).