public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [ecj] VMStackWalker.getCallingClass()
@ 2006-12-05 13:51 Gary Benson
  0 siblings, 0 replies; only message in thread
From: Gary Benson @ 2006-12-05 13:51 UTC (permalink / raw)
  To: java-patches

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

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

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1327 bytes --]

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;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-12-05 13:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-05 13:51 [ecj] VMStackWalker.getCallingClass() Gary Benson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).