From 5b9cd26616f2fe5ed3c99a6bbdb6745ce9d227dc Mon Sep 17 00:00:00 2001 From: kseitz Date: Tue, 13 Feb 2007 18:57:01 +0000 Subject: [PATCH] * gnu/classpath/jdwp/natVMVirtualMachine.cc (jdwpBreakpointCB): New function. (jdwpVMInitCB): Define and enable the breakpoint callback. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121889 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/ChangeLog | 7 +++++ .../gnu/classpath/jdwp/natVMVirtualMachine.cc | 30 +++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 9a53848e7e91..efd3543e60c2 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2007-02-13 Keith Seitz + + * gnu/classpath/jdwp/natVMVirtualMachine.cc + (jdwpBreakpointCB): New function. + (jdwpVMInitCB): Define and enable the breakpoint + callback. + 2007-02-13 Andrew Haley * testsuite/libjava.lang/Divide_2.out diff --git a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc index e06daa7bb242..d219f5889567 100644 --- a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc +++ b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc @@ -15,8 +15,6 @@ details. */ #include #include -#include - #include #include #include @@ -34,6 +32,7 @@ details. */ #include #include #include +#include #include #include #include @@ -71,6 +70,8 @@ struct step_info static Location *get_request_location (EventRequest *); static gnu::classpath::jdwp::event::filters::StepFilter * get_request_step_filter (EventRequest *); +static void JNICALL jdwpBreakpointCB (jvmtiEnv *, JNIEnv *, jthread, + jmethodID, jlocation); static void JNICALL jdwpClassPrepareCB (jvmtiEnv *, JNIEnv *, jthread, jclass); static void JNICALL jdwpThreadEndCB (jvmtiEnv *, JNIEnv *, jthread); static void JNICALL jdwpThreadStartCB (jvmtiEnv *, JNIEnv *, jthread); @@ -643,6 +644,29 @@ throw_jvmti_error (jvmtiError err) throw new JdwpInternalErrorException (msg); } +static void JNICALL +jdwpBreakpointCB (jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, + jthread thread, jmethodID method, jlocation location) +{ + jclass klass; + jvmtiError err; + err = env->GetMethodDeclaringClass (method, &klass); + JvAssert (err == JVMTI_ERROR_NONE); + + using namespace gnu::classpath::jdwp; + + jlong methodId = reinterpret_cast (method); + VMMethod *meth = VMVirtualMachine::getClassMethod (klass, methodId); + Location *loc = new Location (meth, location); + JvAssert (thread->frame.frame_type == frame_interpreter); + _Jv_InterpFrame *iframe + = reinterpret_cast<_Jv_InterpFrame *> (thread->interp_frame); + jobject instance = iframe->get_this_ptr (); + event::BreakpointEvent *event + = new event::BreakpointEvent (thread, loc, instance); + Jdwp::notify (event); +} + static void JNICALL jdwpClassPrepareCB (jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, jthread thread, jclass klass) @@ -703,6 +727,7 @@ jdwpVMInitCB (MAYBE_UNUSED jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, { // The VM is now initialized, add our callbacks jvmtiEventCallbacks callbacks; + DEFINE_CALLBACK (callbacks, Breakpoint); DEFINE_CALLBACK (callbacks, ClassPrepare); DEFINE_CALLBACK (callbacks, ThreadEnd); DEFINE_CALLBACK (callbacks, ThreadStart); @@ -710,6 +735,7 @@ jdwpVMInitCB (MAYBE_UNUSED jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, _jdwp_jvmtiEnv->SetEventCallbacks (&callbacks, sizeof (callbacks)); // Enable callbacks + ENABLE_EVENT (BREAKPOINT, NULL); ENABLE_EVENT (CLASS_PREPARE, NULL); ENABLE_EVENT (THREAD_END, NULL); ENABLE_EVENT (THREAD_START, NULL); -- 2.47.3