Commit f031b5d7 by Keith Seitz Committed by Keith Seitz

natVMVirtualMachine.cc (DEFINE_CALLBACK): New macro.

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

From-SVN: r120833
parent 016a2390
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.
......
......@@ -24,10 +24,12 @@ details. */
#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 java::lang;
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 @@ gnu::classpath::jdwp::VMVirtualMachine::initialize ()
_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 @@ gnu::classpath::jdwp::VMVirtualMachine::getSourceFile (jclass clazz)
{
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));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment