This patch implements changes in VMVirtualMachine and VMFrame to make JDWP stack tracing easier. It adds a constructor and a thread field to VMFrame that had been left out until more details about stack tracing were decided. It also changed VMVM::getFrame to take a long instead of a ByteBuffer for the frameID, whihc invloved changing StackFrameCommandSet to grab the ID out of the ByteBuffer and pass it properly to getFrame.

Changelog
2007-02-01  Kyle Galloway  <[EMAIL PROTECTED]>

   * gnu/classpath/jdwp/processor/StackFrameCommandSet.java
   (executeGetValues): Changed getFrame to use a jlong to pass frameID.
   (executeSetValues): Ditto.
   (executeThisObject): Ditto.
   * vm/reference/gnu/classpath/jdwp/VMFrame.java: Added thread field and a
   constructor used to create VMFrames.
   (getThread): New method.
* vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java(getFrame): Changed
   to take a long instead of a ByteBuffer to pass the frameID.

Comments?

-Kyle
Index: gnu/classpath/jdwp/processor/StackFrameCommandSet.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java,v
retrieving revision 1.6
diff -u -r1.6 StackFrameCommandSet.java
--- gnu/classpath/jdwp/processor/StackFrameCommandSet.java	8 Sep 2005 17:18:59 -0000	1.6
+++ gnu/classpath/jdwp/processor/StackFrameCommandSet.java	1 Feb 2007 14:57:22 -0000
@@ -107,7 +107,8 @@
     // has a reference to them. Furthermore they are not ReferenceTypeIds since
     // these are held permanently and we want these to be held only as long as
     // the Thread is suspended.
-    VMFrame frame = VMVirtualMachine.getFrame(thread, bb);
+    long frameID = bb.getLong();
+    VMFrame frame = VMVirtualMachine.getFrame(thread, frameID);
     int slots = bb.getInt();
     os.writeInt(slots); // Looks pointless but this is the protocol
     for (int i = 0; i < slots; i++)
@@ -125,7 +126,8 @@
     ObjectId tId = idMan.readObjectId(bb);
     Thread thread = (Thread) tId.getObject();
 
-    VMFrame frame = VMVirtualMachine.getFrame(thread, bb);
+    long frameID = bb.getLong();
+    VMFrame frame = VMVirtualMachine.getFrame(thread, frameID);
 
     int slots = bb.getInt();
     for (int i = 0; i < slots; i++)
@@ -142,7 +144,8 @@
     ObjectId tId = idMan.readObjectId(bb);
     Thread thread = (Thread) tId.getObject();
 
-    VMFrame frame = VMVirtualMachine.getFrame(thread, bb);
+    long frameID = bb.getLong();
+    VMFrame frame = VMVirtualMachine.getFrame(thread, frameID);
 
     Object thisObject = frame.getObject();
     Value.writeTaggedValue(os, thisObject);
Index: vm/reference/gnu/classpath/jdwp/VMFrame.java
===================================================================
RCS file: /sources/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMFrame.java,v
retrieving revision 1.5
diff -u -r1.5 VMFrame.java
--- vm/reference/gnu/classpath/jdwp/VMFrame.java	17 Feb 2006 14:49:06 -0000	1.5
+++ vm/reference/gnu/classpath/jdwp/VMFrame.java	1 Feb 2007 14:57:25 -0000
@@ -53,6 +53,9 @@
    * Returns the size of a frame ID over JDWP
    */
   public static final int SIZE = 8;
+  
+  //The thread this frame resides in
+  private Thread thread;
 
   // The object this frame resides in
   private Object obj;
@@ -64,6 +67,20 @@
   private long id;
   
   /**
+   * Create a new VMFrame object.
+   * 
+   * @param thr a Thread, the thread this frame is in
+   * @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)
+  {
+    thread = thr;
+    id = frame_id;
+    loc = frame_loc;
+  }
+  
+  /**
    * Gets the current location of the frame.
    */
   public Location getLocation()
@@ -84,6 +101,14 @@
    * @param value The value to assign the variable to
    */
   public native void setValue(int slot, Object value);
+  
+  /**
+   * Get the thread this frame is in.
+   */
+  public Thread getThread()
+  {
+    return thread;
+  }
 
   /**
    * Get the object which is represented by 'this' in the context of the frame,
Index: vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
===================================================================
RCS file: /sources/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java,v
retrieving revision 1.7
diff -u -r1.7 VMVirtualMachine.java
--- vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java	16 Mar 2006 21:06:09 -0000	1.7
+++ vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java	1 Feb 2007 14:57:25 -0000
@@ -237,7 +237,7 @@
    * @param  bb      buffer containing the frame's ID
    * @return the desired frame
    */
-  public static native VMFrame getFrame (Thread thread, ByteBuffer bb)
+  public static native VMFrame getFrame (Thread thread, long frameID)
     throws JdwpException;
 
   /**

Reply via email to