Hi,
I've been hoarding several classpath patches w.r.t. JDWP while I've been
away, and I think it is time I start committing some of them before
they get out of hand. [Of course, it should also help to put some
people's minds at some ease -- as far as I know, neither I nor Red Hat
has yet abandoned our commitment to getting interpreted debugging in gcj
working.]
So here's a pretty simple one that got overlooked: all methods of
VMVirtualMachine should be allowed to throw an exception. This is useful
when, e.g., an illegal parameter is passed into the JDWP back-end and
the generic code (gnu.classpath.jdwp.processor.*) has no way of
validating the data.
Of course, this necessitates a follow-on patch which removes
ID-to-object resolution in gnu.classpath.jdwp.processor.*, which will
follow shortly.
I assume that I may still commit these changes. Someone please speak up
if I am assuming too much.
Keith
ChangeLog
2005-12-16 Keith Seitz <[EMAIL PROTECTED]>
* vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
(VMVirtualMachine): All methods now throw JdwpException.
Index: vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
===================================================================
RCS file: /sources/classpath/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java,v
retrieving revision 1.1
diff -u -p -r1.1 VMVirtualMachine.java
--- vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java 3 Sep 2005 00:17:50 -0000 1.1
+++ vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java 16 Dec 2005 20:54:22 -0000
@@ -42,6 +42,7 @@ exception statement from your version. *
package gnu.classpath.jdwp;
import gnu.classpath.jdwp.event.EventRequest;
+import gnu.classpath.jdwp.exception.JdwpException;
import gnu.classpath.jdwp.exception.InvalidClassException;
import gnu.classpath.jdwp.exception.InvalidObjectException;
import gnu.classpath.jdwp.id.ObjectId;
@@ -68,12 +69,14 @@ public class VMVirtualMachine
*
* @param thread the thread to suspend
*/
- public static native void suspendThread (Thread thread);
+ public static native void suspendThread (Thread thread)
+ throws JdwpException;
/**
* Suspend all threads
*/
public static void suspendAllThreads ()
+ throws JdwpException
{
// Our JDWP thread group -- don't suspend any of those threads
Thread current = Thread.currentThread ();
@@ -118,7 +121,8 @@ public class VMVirtualMachine
*
* @param thread the thread to resume
*/
- public static native void resumeThread (Thread thread);
+ public static native void resumeThread (Thread thread)
+ throws JdwpException;
/**
* Resume all threads. This simply decrements the thread's
@@ -126,6 +130,7 @@ public class VMVirtualMachine
* to run.
*/
public static void resumeAllThreads ()
+ throws JdwpException
{
// Our JDWP thread group -- don't resume
Thread current = Thread.currentThread ();
@@ -167,17 +172,20 @@ public class VMVirtualMachine
* @param thread the thread whose suspend count is desired
* @return the number of times the thread has been suspended
*/
- public static native int getSuspendCount (Thread thread);
+ public static native int getSuspendCount (Thread thread)
+ throws JdwpException;
/**
* Returns a count of the number of loaded classes in the VM
*/
- public static native int getAllLoadedClassesCount ();
+ public static native int getAllLoadedClassesCount ()
+ throws JdwpException;
/**
* Returns an iterator over all the loaded classes in the VM
*/
- public static native Iterator getAllLoadedClasses ();
+ public static native Iterator getAllLoadedClasses ()
+ throws JdwpException;
/**
* Returns the status of the given class
@@ -186,7 +194,8 @@ public class VMVirtualMachine
* @return a flag containing the class's status
* @see JdwpConstants.ClassStatus
*/
- public static native int getClassStatus (Class clazz);
+ public static native int getClassStatus (Class clazz)
+ throws JdwpException;
/**
@@ -198,7 +207,8 @@ public class VMVirtualMachine
* @return a list of frames
*/
public static native ArrayList getFrames (Thread thread, int strart,
- int length);
+ int length)
+ throws JdwpException;
/**
* Returns the frame for a given thread with the frame ID in
@@ -210,7 +220,8 @@ public class VMVirtualMachine
* @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, ByteBuffer bb)
+ throws JdwpException;
/**
* Returns the number of frames in the thread's stack
@@ -218,7 +229,8 @@ public class VMVirtualMachine
* @param thread the thread for which to get a frame count
* @return the number of frames in the thread's stack
*/
- public static native int getFrameCount (Thread thread);
+ public static native int getFrameCount (Thread thread)
+ throws JdwpException;
/**
@@ -228,7 +240,8 @@ public class VMVirtualMachine
* @return integer status of the thread
* @see JdwpConstants.ThreadStatus
*/
- public static native int getThreadStatus (Thread thread);
+ public static native int getThreadStatus (Thread thread)
+ throws JdwpException;
/**
* Returns a list of all classes which this class loader has been
@@ -237,7 +250,8 @@ public class VMVirtualMachine
* @param cl the class loader
* @return a list of all visible classes
*/
- public static native ArrayList getLoadRequests (ClassLoader cl);
+ public static native ArrayList getLoadRequests (ClassLoader cl)
+ throws JdwpException;
/**
* Executes a method in the virtual machine
@@ -254,7 +268,8 @@ public class VMVirtualMachine
public static native MethodResult executeMethod (Object obj, Thread thread,
Class clazz, Method method,
Object[] values,
- boolean nonVirtual);
+ boolean nonVirtual)
+ throws JdwpException;
/**
* "Returns variable information for the method. The variable table
@@ -266,7 +281,8 @@ public class VMVirtualMachine
* @param method the method for which variable information is desired
* @return a result object containing the information
*/
- public static native VariableTable getVarTable (Class clazz, Method method);
+ public static native VariableTable getVarTable (Class clazz, Method method)
+ throws JdwpException;
/**
* "Returns line number information for the method, if present. The line
@@ -279,7 +295,8 @@ public class VMVirtualMachine
* @param method the method whose line table is desired
* @return a result object containing the line table
*/
- public static native LineTable getLineTable (Class clazz, Method method);
+ public static native LineTable getLineTable (Class clazz, Method method)
+ throws JdwpException;
/**
* "Returns the name of source file in which a reference type was declared"
@@ -288,7 +305,8 @@ public class VMVirtualMachine
* @return a string containing the source file name; "no path information
* for the file is included"
*/
- public static native String getSourceFile (Class clazz);
+ public static native String getSourceFile (Class clazz)
+ throws JdwpException;
/**
* Register a request from the debugger
@@ -299,14 +317,16 @@ public class VMVirtualMachine
* or do some internal work to set up the event notification (useful for
* execution-related events like breakpoints, single-stepping, etc.).
*/
- public static native void registerEvent (EventRequest request);
+ public static native void registerEvent (EventRequest request)
+ throws JdwpException;
/**
* Unregisters the given request
*
* @param request the request to unregister
*/
- public static native void unregisterEvent (EventRequest request);
+ public static native void unregisterEvent (EventRequest request)
+ throws JdwpException;
/**
@@ -314,5 +334,6 @@ public class VMVirtualMachine
*
* @param kind the type of events to clear
*/
- public static native void clearEvents (byte kind);
+ public static native void clearEvents (byte kind)
+ throws JdwpException;
}
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches