This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: PR 11779 fix


I'm checking this in on the trunk.

This fixes PR 11779.  The lookup code in Field is run several layers
deep in the Field class; we have to ignore other frames from Field.

I've put the test case from the PR into Mauve.

Tom

Index: libjava/ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	Fix for PR libgcj/11779:
	* java/lang/reflect/natField.cc (getAddr): Skip frames in Field
	class.

Index: libjava/java/lang/reflect/natField.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/reflect/natField.cc,v
retrieving revision 1.13
diff -u -r1.13 natField.cc
--- libjava/java/lang/reflect/natField.cc 21 Jul 2003 01:54:06 -0000 1.13
+++ libjava/java/lang/reflect/natField.cc 5 Aug 2003 19:59:08 -0000
@@ -59,13 +59,14 @@
   // calls.  However, we never implemented that, so we have to find
   // the caller by hand instead.
   gnu::gcj::runtime::StackTrace *t 
-    = new gnu::gcj::runtime::StackTrace(4);
+    = new gnu::gcj::runtime::StackTrace(7);
   try
     {
-      for (int i = 1; !caller; i++)
-	{
-	  caller = t->classAt (i);
-	}
+      // We want to skip all the frames on the stack from this class.
+      for (int i = 1;
+	   !caller || caller == &java::lang::reflect::Field::class$;
+	   i++)
+	caller = t->classAt (i);
     }
   catch (::java::lang::ArrayIndexOutOfBoundsException *e)
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]