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]

[RFA] Check for null arguments when interpreting static methods


If _Jv_CompileMethod is called while debugging with a static method, the debugging code that finds the "this" pointer in _Jv_InterpMethod::run will attempt to dereference args, but this is set to NULL when the call is made. This patch checks if args is NULL before attempting to retrieve the "this" pointer.

ChangeLog
2007-04-09  Kyle Galloway  <kgallowa@redhat.com>

* interpret-run.cc: If debugging, check if args is NULL before getting the "this" pointer.

Questions/comments/concerns?

Thanks,
Kyle
Index: interpret-run.cc
===================================================================
--- interpret-run.cc	(revision 123427)
+++ interpret-run.cc	(working copy)
@@ -46,9 +46,13 @@
   // If the method is non-static, we need to set the type for the "this" pointer.
   if ((method->accflags & java::lang::reflect::Modifier::STATIC) == 0)
     {
-      // Set the "this" pointer for this frame
-      _Jv_word *this_ptr = reinterpret_cast<_Jv_word *> (args);
-      frame_desc.obj_ptr = this_ptr[0].o;
+      if (args)
+        {
+          // Set the "this" pointer for this frame.
+          _Jv_word *this_ptr = reinterpret_cast<_Jv_word *> (args);
+          frame_desc.obj_ptr = this_ptr[0].o;
+        }
+
       frame_desc.locals_type[0] = 'o';
       type_ctr++;
     }

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