This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[RFA] Check for null arguments when interpreting static methods
- From: Kyle Galloway <kgallowa at redhat dot com>
- To: GCJ-patches <java-patches at gcc dot gnu dot org>
- Date: Mon, 09 Apr 2007 13:38:21 -0400
- Subject: [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++;
}