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/JDWP] Fix VMFrame "this" pointer


This patch, the java side of which has already been committed to
Classpath, fixes VMFrame so it properly handles "this" pointers for
frames.  It adds a parameter in the constructor for VMFrame, which is
then used to properly set the value for the "this" pointer of the frame
the created object represents.  This patch also includes the necessary
changes to natVMVirtualMachine.  As per spec, if the method represented
by this VMFrame is native, this pointer will be set to null, regardless
of whether the method is static.

ChangeLog
2007-05-08  Kyle Galloway  <kgallowa@redhat.com>

    * gnu/classpath/jdwp/VMFrame.java (<init>): Add parameter for "this"
pointer.
    * gnu/classpath/jdwp/VMFrame.h: Regenerated.
    * classpath/lib/gnu/classpath/jdwp/VMFrame.class: Rebuilt.
    *  gnu/classpath/jdwp/natVMVirtualMachine.cc (getFrame): Change to
use new
    VMFrame constructor.

Questions/comments/concerns?

Thanks,
Kyle

Index: gnu/classpath/jdwp/VMFrame.java
===================================================================
--- gnu/classpath/jdwp/VMFrame.java	(revision 124570)
+++ gnu/classpath/jdwp/VMFrame.java	(working copy)
@@ -74,11 +74,13 @@
    * @param frame_id a long, the jframeID of this frame
    * @param frame_loc a Location, the location of this frame
    */
-  public VMFrame(Thread thr, long frame_id, Location frame_loc)
+  public VMFrame(Thread thr, long frame_id, Location frame_loc,
+                 Object frame_obj)
   {
     thread = thr;
     id = frame_id;
     loc = frame_loc;
+    obj = frame_obj;
   }
   
   /**
Index: gnu/classpath/jdwp/natVMVirtualMachine.cc
===================================================================
--- gnu/classpath/jdwp/natVMVirtualMachine.cc	(revision 124570)
+++ gnu/classpath/jdwp/natVMVirtualMachine.cc	(working copy)
@@ -617,12 +617,22 @@
   VMMethod *meth 
     = getClassMethod (klass, reinterpret_cast<jlong> (info.method));
   
+  jobject this_obj;
+  
   if (info.location == -1)
-    loc = new Location (meth, 0);
+    {
+      loc = new Location (meth, 0);
+      this_obj = NULL;
+    }
   else
-    loc = new Location (meth, info.location);
+    {
+      loc = new Location (meth, info.location);
+      _Jv_InterpFrame *iframe = reinterpret_cast<_Jv_InterpFrame *> (vm_frame);
+      this_obj = iframe->get_this_ptr ();
+    }
   
-  return new VMFrame (thread, reinterpret_cast<jlong> (vm_frame), loc); 
+  return new VMFrame (thread, reinterpret_cast<jlong> (vm_frame), loc,
+                      this_obj); 
 }
 
 jint

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