summaryrefslogtreecommitdiffstats
path: root/libjava/gnu
diff options
context:
space:
mode:
authorkgallowa <kgallowa@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-15 14:49:50 +0000
committerkgallowa <kgallowa@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-15 14:49:50 +0000
commitf29df0d6a3288de33b8f2aa9d02d039fe2347f32 (patch)
treeb6fcfec2b20b166cb494d556988e1edde4624e05 /libjava/gnu
parent26302631c5a3085ae1afd3591fae527c0a02829f (diff)
downloadppe42-gcc-f29df0d6a3288de33b8f2aa9d02d039fe2347f32.tar.gz
ppe42-gcc-f29df0d6a3288de33b8f2aa9d02d039fe2347f32.zip
2007-02-15 Kyle Galloway <kgallowa@redhat.com>
* gnu/classpath/jdwp/natVMVirtualMachine (getFrames): Implement. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121997 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu')
-rw-r--r--libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc46
1 files changed, 42 insertions, 4 deletions
diff --git a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc
index d219f588956..71aa674054a 100644
--- a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc
+++ b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc
@@ -486,11 +486,49 @@ getClassMethod (jclass klass, jlong id)
}
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;
+
+ // Calculate the max number of frames to be returned.
+ jint num_frames = frame_count - start;
+
+ // Check if num_frames is valid.
+ if (num_frames < 0)
+ num_frames = 0;
+
+ // Check if there are more than length frames left after start.
+ // If length ios -1 return all remaining frames.
+ if (length != -1 && num_frames > length)
+ num_frames = length;
+
+ frame_list = new ::java::util::ArrayList (num_frames);
+
+ _Jv_Frame *vm_frame = reinterpret_cast<_Jv_Frame *> (thread->frame);
+
+ // Take start frames off the top of the stack
+ while (vm_frame != NULL && start > 0)
+ {
+ start--;
+ vm_frame = vm_frame->next;
+ }
+
+ // Use as a counter for the number of frames returned.
+ num_frames = 0;
+
+ while (vm_frame != NULL && (num_frames < length || length == -1))
+ {
+ jlong frameId = reinterpret_cast<jlong> (vm_frame);
+
+ VMFrame *frame = getFrame (thread, frameId);
+ frame_list->add (frame);
+ vm_frame = vm_frame->next;
+ num_frames++;
+ }
+
+ return frame_list;
}
gnu::classpath::jdwp::VMFrame *
OpenPOWER on IntegriCloud