This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
RFA: JVMTI GetFrameCount
- From: Kyle Galloway <kgallowa at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Mon, 31 Jul 2006 09:38:40 -0400
- Subject: RFA: JVMTI GetFrameCount
This patch implements the GetFrameCount functionality of jvmti. Any
comments? If not could someone please commit this.
Kyle
Index: /home/kgallowa/workspace/FORTHELOVEOFGODDONTMODIFY/ChangeLog
===================================================================
--- /home/kgallowa/workspace/FORTHELOVEOFGODDONTMODIFY/ChangeLog (revision 115838)
+++ /home/kgallowa/workspace/FORTHELOVEOFGODDONTMODIFY/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2006-07-31 Kyle Galloway <kgallowa@redhat.com>
+
+ * jvmti.cc (GetFrameCount): New Method.
+
2006-07-28 Andrew Haley <aph@redhat.com>
* gnu/gcj/runtime/natSharedLibLoader.cc (init): Don't set
Index: /home/kgallowa/workspace/FORTHELOVEOFGODDONTMODIFY/jvmti.cc
===================================================================
--- /home/kgallowa/workspace/FORTHELOVEOFGODDONTMODIFY/jvmti.cc (revision 115838)
+++ /home/kgallowa/workspace/FORTHELOVEOFGODDONTMODIFY/jvmti.cc (working copy)
@@ -61,6 +61,32 @@
return JVMTI_ERROR_NONE;
}
+static jvmtiError JNICALL
+_Jv_JVMTI_GetFrameCount (MAYBE_UNUSED jvmtiEnv *env, jthread thread, jint *count)
+{
+ if (count == NULL)
+ return JVMTI_ERROR_NULL_POINTER;
+
+ using namespace java::lang;
+ THREAD_DEFAULT_TO_CURRENT (thread);
+ THREAD_CHECK_VALID (thread);
+
+ Thread *t = reinterpret_cast<Thread *> (thread);
+ THREAD_CHECK_IS_ALIVE (t);
+
+ //get the top frame
+ _Jv_InterpFrame* top = reinterpret_cast<_Jv_InterpFrame *> (t->interp_frame);
+ *count = 0;
+
+ while (top != NULL)
+ {
+ (*count)++;
+ top = top->next;
+ }
+
+ return JVMTI_ERROR_NONE;
+}
+
#define RESERVED NULL
#define UNIMPLEMENTED NULL