This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [RFA] Step & Breakpoint co-located events
- From: Keith Seitz <keiths at redhat dot com>
- To: tromey at redhat dot com
- Cc: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Wed, 16 May 2007 10:49:47 -0700
- Subject: Re: [RFA] Step & Breakpoint co-located events
- References: <463FCE4C.3070006@redhat.com> <m3ps51luw1.fsf@fleche.redhat.com>
Tom Tromey wrote:
"Keith" == Keith Seitz <keiths@redhat.com> writes:
There's a small bug in here...
Keith> + _event_list = new ::java::util::ArrayList ();
Keith> + JArray<Event *> *events
Keith> + = (JArray<Event *> *) VMVirtualMachine::_event_list->toArray ();
toArray always returns an Object[].
If you want an Event[] you have to use the toArray(Object[]) form.
I've fixed that, and I've rewritten the notification in that function a
bit. It now always adds the breakpoint event to the list, converts to an
array, and calls Jdwp.notify(Event[]). It doesn't really seem to save us
much for an additional code path. [Okay, it's still a malloc and a copy,
but this is really non-critical code anyway.]
Patch for that is attached. Look better?
Keith
Index: gnu/classpath/jdwp/natVMVirtualMachine.cc
===================================================================
--- gnu/classpath/jdwp/natVMVirtualMachine.cc (revision 124775)
+++ gnu/classpath/jdwp/natVMVirtualMachine.cc (working copy)
@@ -925,6 +942,7 @@
JvAssert (err == JVMTI_ERROR_NONE);
using namespace gnu::classpath::jdwp;
+ using namespace gnu::classpath::jdwp::event;
jlong methodId = reinterpret_cast<jlong> (method);
VMMethod *meth = VMVirtualMachine::getClassMethod (klass, methodId);
@@ -933,9 +951,16 @@
_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<Event *> *events
+ = ((JArray<Event *> *)
+ JvNewObjectArray (VMVirtualMachine::_event_list->size (),
+ &Event::class$, NULL));
+ VMVirtualMachine::_event_list->toArray ((jobjectArray) events);
+ VMVirtualMachine::_event_list->clear ();
+ Jdwp::notify (events);
}
static void JNICALL