This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[RFA/JDWP] Implement VMVM:getFrames
- From: Kyle Galloway <kgallowa at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Fri, 09 Feb 2007 10:09:46 -0500
- Subject: [RFA/JDWP] Implement VMVM:getFrames
Hi,
This patch implements the final portion of JDWP stack tracing. what I
have done here is to use VMVM:getFrame to get each frame and them just
pack them into an array. It is also possible to have getFrames call
JVMTI directly, but it think it would be better to have getFrame do the
processing from JVMTI to a VMFrame to avoid having to duplicate much of
that code. Are there other opinions?
If not is this ok to go in?
ChangeLog
2007-02-09 Kyle Galloway <kgallowa@redhat.com>
* gnu/classpath/jdwp/natVMVirtualMachine (getFrames): Implement.
Thanks,
Kyle
Index: libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc
===================================================================
--- libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc (revision 121719)
+++ libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc (working copy)
@@ -427,11 +427,34 @@
}
java::util::ArrayList *
-gnu::classpath::jdwp::VMVirtualMachine::getFrames (MAYBE_UNUSED Thread *thread,
- MAYBE_UNUSED jint start,
- MAYBE_UNUSED jint length)
+gnu::classpath::jdwp::VMVirtualMachine::getFrames (Thread *thread, jint start,
+ jint length)
{
- return NULL;
+ jint frame_count = getFrameCount (thread);
+ ::java::util::ArrayList *frame_list;
+
+ frame_list = new ::java::util::ArrayList (frame_count);
+
+ _Jv_Frame *vm_frame = reinterpret_cast<_Jv_Frame *> (thread->frame);
+
+ while (vm_frame != NULL)
+ {
+ // Take start frames off the top of the stack.
+ if (start-- > 0)
+ continue;
+
+ // Only return length frames.
+ if (length != -1 && length-- <= 0)
+ break;
+
+ jlong frameId = reinterpret_cast<jlong> (vm_frame);
+
+ VMFrame *frame = getFrame (thread, frameId);
+ frame_list->add (frame);
+ vm_frame = vm_frame->next;
+ }
+
+ return frame_list;
}
gnu::classpath::jdwp::VMFrame *