+2007-01-16 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.
+
2007-01-16 Kyle Galloway <kgallowa@redhat.com>
* jvmti.cc (_Jv_JVMTI_GetAllThreads): New function.
#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>
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;
_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
{
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));
+}