From 27d8ff9b8349ec64ebeeb7ccc6c4516580bf3a81 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Fri, 4 Aug 2006 20:34:02 +0000 Subject: VMFrame.java: Update to Classpath 0.91. * gnu/classpath/jdwp/VMFrame.java: Update to Classpath 0.91. * gnu/classpath/jdwp/VMIdManager.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine: Likewise. * gnu/classpath/jdwp/natVMFrame.java: New file. * gnu/classpath/jdwp/natVMMethod.java: New file. * gnu/classpath/jdwp/natVMVirtualMachine.java: New file. * Makefile.am (nat_source_files): Add new filles. * Makefile.in: Regenerated. From-SVN: r115934 --- libjava/gnu/classpath/jdwp/VMFrame.java | 4 +- libjava/gnu/classpath/jdwp/VMIdManager.java | 16 +- libjava/gnu/classpath/jdwp/VMMethod.java | 14 +- libjava/gnu/classpath/jdwp/VMVirtualMachine.java | 65 +++--- libjava/gnu/classpath/jdwp/natVMFrame.cc | 26 +++ libjava/gnu/classpath/jdwp/natVMMethod.cc | 47 +++++ libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc | 240 ++++++++++++++++++++++ 7 files changed, 366 insertions(+), 46 deletions(-) create mode 100644 libjava/gnu/classpath/jdwp/natVMFrame.cc create mode 100644 libjava/gnu/classpath/jdwp/natVMMethod.cc create mode 100644 libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc (limited to 'libjava/gnu') diff --git a/libjava/gnu/classpath/jdwp/VMFrame.java b/libjava/gnu/classpath/jdwp/VMFrame.java index 840ca09..cd21302 100644 --- a/libjava/gnu/classpath/jdwp/VMFrame.java +++ b/libjava/gnu/classpath/jdwp/VMFrame.java @@ -76,14 +76,14 @@ public class VMFrame * * @param slot the slot containing the variable */ - public Object getValue(int slot) { return null; } + public native Object getValue(int slot); /** * Assigns the given variable to the given value. * @param slot The slot which contains the variable * @param value The value to assign the variable to */ - public void setValue(int slot, Object value) { } + public native void setValue(int slot, Object value); /** * Get the object which is represented by 'this' in the context of the frame, diff --git a/libjava/gnu/classpath/jdwp/VMIdManager.java b/libjava/gnu/classpath/jdwp/VMIdManager.java index 23cbb7b..8d423e9 100644 --- a/libjava/gnu/classpath/jdwp/VMIdManager.java +++ b/libjava/gnu/classpath/jdwp/VMIdManager.java @@ -1,7 +1,7 @@ /* VMIdManager.java -- A reference/example implementation of a manager for JDWP object/reference type IDs - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2006 Free Software Foundation This file is part of GNU Classpath. @@ -48,11 +48,9 @@ import gnu.classpath.jdwp.id.*; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; -import java.io.IOException; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Hashtable; -import java.util.Iterator; /** * This class manages objects and referencetypes that are reported @@ -76,6 +74,10 @@ import java.util.Iterator; * NOTE: All IDs handled by the ID manager (all object and reference * type IDs) are assumed to be of type long. * + * NOTE: This class does not manage virtual machine-specific types, + * like methods, fields, and frames. These already have unique IDs within + * the virtual machine and do not need further abstraction here. + * * @author Keith Seitz (keiths@redhat.com) */ public class VMIdManager @@ -99,9 +101,6 @@ public class VMIdManager // ObjectId and ArrayId are special cases. See newObjectId. _idList.put (ClassLoaderId.typeClass, ClassLoaderId.class); _idList.put (ClassObjectId.typeClass, ClassObjectId.class); - //_idList.put (FieldId.typeClass, FieldId.class); - //_idList.put (FrameId.typeClass, FrameId.class); - //_idList.put (MethodId.typeClass, MethodId.class); _idList.put (StringId.typeClass, StringId.class); _idList.put (ThreadId.typeClass, ThreadId.class); _idList.put (ThreadGroupId.typeClass, ThreadGroupId.class); @@ -110,7 +109,7 @@ public class VMIdManager /** * Returns a new id for the given object * - * @param object the object for which an id is desired + * @param obj SoftReference of the object for which an id is desired * @returns a suitable object id */ public static ObjectId newObjectId (SoftReference obj) @@ -170,7 +169,7 @@ public class VMIdManager /** * Returns a new reference type id for the given class * - * @param clazz the Class for which an id is desired + * @param ref SoftReference to the desired type * @returns a suitable reference type id or null when the * reference is cleared. */ @@ -187,6 +186,7 @@ public class VMIdManager id = new InterfaceReferenceTypeId (); else id = new ClassReferenceTypeId (); + id.setReference (ref); synchronized (_ridLock) { id.setId (++_lastRid); diff --git a/libjava/gnu/classpath/jdwp/VMMethod.java b/libjava/gnu/classpath/jdwp/VMMethod.java index a4bbb51..d345bc1 100644 --- a/libjava/gnu/classpath/jdwp/VMMethod.java +++ b/libjava/gnu/classpath/jdwp/VMMethod.java @@ -103,17 +103,17 @@ public class VMMethod /** * Returns the name of this method */ - public String getName() { return null; } + public native String getName(); /** * Returns the signature of this method */ - public String getSignature() { return null; } + public native String getSignature(); /** * Returns the method's modifier flags */ - public int getModifiers() { return -1; } + public native int getModifiers(); /** * "Returns line number information for the method, if present. The line @@ -125,8 +125,8 @@ public class VMMethod * @return the line table * @throws JdwpException */ - public LineTable getLineTable() - { return null; } + public native LineTable getLineTable() + throws JdwpException; /** * "Returns variable information for the method. The variable table @@ -137,8 +137,8 @@ public class VMMethod * @return the variable table * @throws JdwpException */ - public VariableTable getVariableTable() - { return null; } + public native VariableTable getVariableTable() + throws JdwpException; /** * Returns a string representation of this method (not diff --git a/libjava/gnu/classpath/jdwp/VMVirtualMachine.java b/libjava/gnu/classpath/jdwp/VMVirtualMachine.java index ac81d95..d4985bf 100644 --- a/libjava/gnu/classpath/jdwp/VMVirtualMachine.java +++ b/libjava/gnu/classpath/jdwp/VMVirtualMachine.java @@ -62,7 +62,8 @@ public class VMVirtualMachine * * @param thread the thread to suspend */ - public static void suspendThread (Thread thread) { } + public static native void suspendThread (Thread thread) + throws JdwpException; /** * Suspend all threads @@ -114,7 +115,8 @@ public class VMVirtualMachine * * @param thread the thread to resume */ - public static void resumeThread (Thread thread) { } + public static native void resumeThread (Thread thread) + throws JdwpException; /** * Resume all threads. This simply decrements the thread's @@ -164,17 +166,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 int getSuspendCount (Thread thread) { return -1; } + public static native int getSuspendCount (Thread thread) + throws JdwpException; /** * Returns a count of the number of loaded classes in the VM */ - public static int getAllLoadedClassesCount () { return -1; } + public static native int getAllLoadedClassesCount () + throws JdwpException; /** * Returns an iterator over all the loaded classes in the VM */ - public static Iterator getAllLoadedClasses () { return null; } + public static native Iterator getAllLoadedClasses () + throws JdwpException; /** * Returns the status of the given class @@ -183,7 +188,8 @@ public class VMVirtualMachine * @return a flag containing the class's status * @see JdwpConstants.ClassStatus */ - public static int getClassStatus (Class clazz) { return -1; } + public static native int getClassStatus (Class clazz) + throws JdwpException; /** * Returns all of the methods defined in the given class. This @@ -192,8 +198,8 @@ public class VMVirtualMachine * @param klass the class whose methods are desired * @return an array of virtual machine methods */ - public static VMMethod[] getAllClassMethods (Class klass) - { return null; } + public static native VMMethod[] getAllClassMethods (Class klass) + throws JdwpException; /** * A factory method for getting valid virtual machine methods @@ -206,8 +212,8 @@ public class VMVirtualMachine * in the class * @throws JdwpException for any other error */ - public static VMMethod getClassMethod(Class klass, long id) - { return null; } + public static native VMMethod getClassMethod(Class klass, long id) + throws JdwpException; /** * Returns the thread's call stack @@ -217,9 +223,9 @@ public class VMVirtualMachine * @param length number of frames to return (-1 for all frames) * @return a list of frames */ - public static ArrayList getFrames (Thread thread, int strart, + public static native ArrayList getFrames (Thread thread, int start, int length) - { return null; } + throws JdwpException; /** * Returns the frame for a given thread with the frame ID in @@ -231,8 +237,8 @@ public class VMVirtualMachine * @param bb buffer containing the frame's ID * @return the desired frame */ - public static VMFrame getFrame (Thread thread, ByteBuffer bb) - { return null; } + public static native VMFrame getFrame (Thread thread, ByteBuffer bb) + throws JdwpException; /** * Returns the number of frames in the thread's stack @@ -240,8 +246,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 int getFrameCount (Thread thread) - { return -1; } + public static native int getFrameCount (Thread thread) + throws JdwpException; /** @@ -251,8 +257,8 @@ public class VMVirtualMachine * @return integer status of the thread * @see JdwpConstants.ThreadStatus */ - public static int getThreadStatus (Thread thread) - { return -1; } + public static native int getThreadStatus (Thread thread) + throws JdwpException; /** * Returns a list of all classes which this class loader has been @@ -261,8 +267,8 @@ public class VMVirtualMachine * @param cl the class loader * @return a list of all visible classes */ - public static ArrayList getLoadRequests (ClassLoader cl) - { return null; } + public static native ArrayList getLoadRequests (ClassLoader cl) + throws JdwpException; /** * Executes a method in the virtual machine @@ -276,11 +282,11 @@ public class VMVirtualMachine * (instance methods only) " * @return a result object containing the results of the invocation */ - public static MethodResult executeMethod (Object obj, Thread thread, + public static native MethodResult executeMethod (Object obj, Thread thread, Class clazz, Method method, Object[] values, boolean nonVirtual) - { return null; } + throws JdwpException; /** * "Returns the name of source file in which a reference type was declared" @@ -289,8 +295,8 @@ public class VMVirtualMachine * @return a string containing the source file name; "no path information * for the file is included" */ - public static String getSourceFile (Class clazz) - { return null; } + public static native String getSourceFile (Class clazz) + throws JdwpException; /** * Register a request from the debugger @@ -301,16 +307,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 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 void unregisterEvent (EventRequest request) - { } + public static native void unregisterEvent (EventRequest request) + throws JdwpException; /** @@ -318,5 +324,6 @@ public class VMVirtualMachine * * @param kind the type of events to clear */ - public static void clearEvents (byte kind) { } + public static native void clearEvents (byte kind) + throws JdwpException; } diff --git a/libjava/gnu/classpath/jdwp/natVMFrame.cc b/libjava/gnu/classpath/jdwp/natVMFrame.cc new file mode 100644 index 0000000..de3b844 --- /dev/null +++ b/libjava/gnu/classpath/jdwp/natVMFrame.cc @@ -0,0 +1,26 @@ +// natFrame.cc -- native support for VMFrame.java + +/* Copyright (C) 2006 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include + +#include + +using namespace java::lang; + +Object* +gnu::classpath::jdwp::VMFrame::getValue (jint slot) +{ + return 0; +} + +void +gnu::classpath::jdwp::VMFrame::setValue (jint slot, Object* value) +{ +} diff --git a/libjava/gnu/classpath/jdwp/natVMMethod.cc b/libjava/gnu/classpath/jdwp/natVMMethod.cc new file mode 100644 index 0000000..eb1d6fd --- /dev/null +++ b/libjava/gnu/classpath/jdwp/natVMMethod.cc @@ -0,0 +1,47 @@ +// natVMMethod.cc -- native support for VMMethod + +/* Copyright (C) 2006 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include +#include + +#include +#include +#include + +java::lang::String* +gnu::classpath::jdwp::VMMethod::getName () +{ + return NULL; +} + +java::lang::String* +gnu::classpath::jdwp::VMMethod::getSignature () +{ + return NULL; +} + +jint +gnu::classpath::jdwp::VMMethod::getModifiers () +{ + return 0; +} + +gnu::classpath::jdwp::util::LineTable* +gnu::classpath::jdwp::VMMethod::getLineTable () +{ + return NULL; +} + + +gnu::classpath::jdwp::util::VariableTable* +gnu::classpath::jdwp::VMMethod::getVariableTable () +{ + return NULL; +} diff --git a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc new file mode 100644 index 0000000..ef4605b --- /dev/null +++ b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc @@ -0,0 +1,240 @@ +// natVMVirtualMachine.cc - native support for VMVirtualMachine + +/* Copyright (C) 2006 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +using namespace java::lang; +using namespace gnu::classpath::jdwp::event; +using namespace gnu::classpath::jdwp::util; + +void +gnu::classpath::jdwp::VMVirtualMachine ::suspendThread (Thread *thread) +{ +} + +void +gnu::classpath::jdwp::VMVirtualMachine::resumeThread (Thread *thread) +{ +} + +jint +gnu::classpath::jdwp::VMVirtualMachine::getSuspendCount (Thread *thread) +{ + return 0; +} + +void +gnu::classpath::jdwp::VMVirtualMachine::registerEvent (EventRequest *request) +{ + switch (request->getEventKind ()) + { + case EventRequest::EVENT_SINGLE_STEP: + break; + + case EventRequest::EVENT_BREAKPOINT: + break; + + case EventRequest::EVENT_FRAME_POP: + break; + + case EventRequest::EVENT_EXCEPTION: + break; + + case EventRequest::EVENT_USER_DEFINED: + break; + + case EventRequest::EVENT_THREAD_START: + break; + + case EventRequest::EVENT_THREAD_END: + break; + + case EventRequest::EVENT_CLASS_PREPARE: + break; + + case EventRequest::EVENT_CLASS_LOAD: + break; + + case EventRequest::EVENT_CLASS_UNLOAD: + break; + + case EventRequest::EVENT_FIELD_ACCESS: + break; + + case EventRequest::EVENT_FIELD_MODIFY: + break; + + case EventRequest::EVENT_METHOD_ENTRY: + break; + + case EventRequest::EVENT_METHOD_EXIT: + break; + + case EventRequest::EVENT_VM_INIT: + break; + + case EventRequest::EVENT_VM_DEATH: + break; + } +} + +void +gnu::classpath::jdwp::VMVirtualMachine::unregisterEvent (EventRequest *request) +{ + switch (request->getEventKind ()) + { + case EventRequest::EVENT_SINGLE_STEP: + break; + + case EventRequest::EVENT_BREAKPOINT: + break; + + case EventRequest::EVENT_FRAME_POP: + break; + + case EventRequest::EVENT_EXCEPTION: + break; + + case EventRequest::EVENT_USER_DEFINED: + break; + + case EventRequest::EVENT_THREAD_START: + break; + + case EventRequest::EVENT_THREAD_END: + break; + + case EventRequest::EVENT_CLASS_PREPARE: + break; + + case EventRequest::EVENT_CLASS_LOAD: + break; + + case EventRequest::EVENT_CLASS_UNLOAD: + break; + + case EventRequest::EVENT_FIELD_ACCESS: + break; + + case EventRequest::EVENT_FIELD_MODIFY: + break; + + case EventRequest::EVENT_METHOD_ENTRY: + break; + + case EventRequest::EVENT_METHOD_EXIT: + break; + + case EventRequest::EVENT_VM_INIT: + break; + + case EventRequest::EVENT_VM_DEATH: + break; + } +} + +void +gnu::classpath::jdwp::VMVirtualMachine::clearEvents (jbyte kind) +{ +} + +jint +gnu::classpath::jdwp::VMVirtualMachine::getAllLoadedClassesCount (void) +{ + return 0; +} + +java::util::Iterator * +gnu::classpath::jdwp::VMVirtualMachine::getAllLoadedClasses (void) +{ + return NULL; +} + +jint +gnu::classpath::jdwp::VMVirtualMachine::getClassStatus (jclass klass) +{ + return 0; +} + +JArray * +gnu::classpath::jdwp::VMVirtualMachine::getAllClassMethods (jclass klass) +{ + return NULL; +} + +gnu::classpath::jdwp::VMMethod * +gnu::classpath::jdwp::VMVirtualMachine::getClassMethod (jclass klass, jlong id) +{ + return NULL; +} + +java::util::ArrayList * +gnu::classpath::jdwp::VMVirtualMachine::getFrames (Thread *thread, + jint start, + jint length) +{ + return NULL; +} + +gnu::classpath::jdwp::VMFrame * +gnu::classpath::jdwp::VMVirtualMachine::getFrame (Thread *thread, + ::java::nio::ByteBuffer *bb) +{ + return NULL; +} + +jint +gnu::classpath::jdwp::VMVirtualMachine::getFrameCount (Thread *thread) +{ + return 0; +} + +jint +gnu::classpath::jdwp::VMVirtualMachine::getThreadStatus (Thread *thread) +{ + return 0; +} + +java::util::ArrayList * +gnu::classpath::jdwp::VMVirtualMachine::getLoadRequests (ClassLoader *cl) +{ + return NULL; +} + +MethodResult * +gnu::classpath::jdwp::VMVirtualMachine::executeMethod (jobject obj, + Thread *thread, + jclass clazz, + reflect::Method *method, + jobjectArray values, + jboolean nonVirtual) +{ + return NULL; +} + +jstring +gnu::classpath::jdwp::VMVirtualMachine::getSourceFile (jclass clazz) +{ + return NULL; +} -- cgit v1.1