X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=libjava%2Fgnu%2Fclasspath%2Fjdwp%2FnatVMVirtualMachine.cc;h=7fee49bee4c90b81403f4f89a64a154e4925aebb;hb=54a9e35cd0e1d924b64f58396fc2fc1ea667f107;hp=3c89b9863ecdc0b6112b3d4f22963cd7a4f6cc15;hpb=1f14446adb1e15a05bbb5c5baaef3d7c41c34a0f;p=pf3gnuchains%2Fgcc-fork.git diff --git a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc index 3c89b9863ec..7fee49bee4c 100644 --- a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc +++ b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc @@ -116,6 +116,7 @@ gnu::classpath::jdwp::VMVirtualMachine::initialize () { _jdwp_suspend_counts = new ::java::util::Hashtable (); _stepping_threads = new ::java::util::Hashtable (); + _event_list = new ::java::util::ArrayList (); JavaVM *vm = _Jv_GetJavaVM (); union @@ -895,7 +896,23 @@ handle_single_step (jvmtiEnv *env, struct step_info *sinfo, jthread thread, jobject instance = iframe->get_this_ptr (); event::SingleStepEvent *event = new event::SingleStepEvent (thread, loc, instance); - Jdwp::notify (event); + + // We only want to send the notification (and consequently + // suspend) if we are not about to execute a breakpoint. + _Jv_InterpMethod *im = reinterpret_cast<_Jv_InterpMethod *> (iframe->self); + if (im->breakpoint_at (location)) + { + // Next insn is a breakpoint -- record event and + // wait for the JVMTI breakpoint notification to + // enforce a suspension policy. + VMVirtualMachine::_event_list->add (event); + } + else + { + // Next insn is not a breakpoint, so send notification + // and enforce the suspend policy. + Jdwp::notify (event); + } } static void @@ -925,6 +942,7 @@ jdwpBreakpointCB (jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, JvAssert (err == JVMTI_ERROR_NONE); using namespace gnu::classpath::jdwp; + using namespace gnu::classpath::jdwp::event; jlong methodId = reinterpret_cast (method); VMMethod *meth = VMVirtualMachine::getClassMethod (klass, methodId); @@ -933,9 +951,16 @@ jdwpBreakpointCB (jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, _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); + BreakpointEvent *event = new BreakpointEvent (thread, loc, instance); + + VMVirtualMachine::_event_list->add (event); + JArray *events + = ((JArray *) + JvNewObjectArray (VMVirtualMachine::_event_list->size (), + &Event::class$, NULL)); + VMVirtualMachine::_event_list->toArray ((jobjectArray) events); + VMVirtualMachine::_event_list->clear (); + Jdwp::notify (events); } static void JNICALL @@ -1001,7 +1026,7 @@ jdwpExceptionCB (jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, jthread thread, } static void JNICALL -jdwpSingleStepCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread, +jdwpSingleStepCB (jvmtiEnv *env, MAYBE_UNUSED JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location) { jobject si =