[ecj] VMStackWalker.getCallingClass()

Gary Benson gbenson@redhat.com
Tue Dec 5 13:51:00 GMT 2006


Hi all,

This commit makes VMStackWalker.getCallingClass() work when the
caller is a compiled frame and the caller of the caller is an
interpreted frame.

Cheers,
Gary
-------------- next part --------------
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 119539)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2006-12-05  Gary Benson  <gbenson@redhat.com>
+
+	* gnu/classpath/natVMStackWalker.cc (getCallingClass): Unwind
+	the stack when the caller is a compiled frame and the caller
+	of the caller is an interpreted frame.
+
 2006-12-04  Adam Megacz <megacz@cs.berkeley.edu>
 
 	* gnu/gcj/runtime/natSharedLibLoader.cc (init): add "::" to fix
Index: gnu/classpath/natVMStackWalker.cc
===================================================================
--- gnu/classpath/natVMStackWalker.cc	(revision 119539)
+++ gnu/classpath/natVMStackWalker.cc	(working copy)
@@ -42,9 +42,15 @@
   _Jv_StackTrace::UpdateNCodeMap ();
   jclass klass = (jclass) _Jv_StackTrace::ncodeMap->get ((jobject) f);
 
-  // FIXME: If klass is null at this point, we need to use the
-  // unwinder machinery to scan the stack to find the real caller.
-  JvAssert (klass);
+  // If the caller is a compiled frame and the caller of the caller
+  // is an interpreted frame then klass will be null and we need to
+  // unwind the stack.
+  if (klass == NULL)
+    {
+      JArray<jclass> *ctx = getClassContext ();
+      if (ctx->length >= 3)
+	klass = elements(ctx)[2];
+    }
 
   return klass;
 }


More information about the Java-patches mailing list