* [RFA/JDWP] Update gnu/classpath/jdwp to Classpath 0.91
@ 2006-08-01 18:12 Keith Seitz
2006-08-01 22:14 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2006-08-01 18:12 UTC (permalink / raw)
To: java-patches
[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]
Hi,
Astute readers will have noticed that there appears to be a merge botch
with the gnu.classpath.jdwp VM interfaces: the files are not those
released with Classpath 0.91. [FWIW: none of these interfaces has
changed between 0.91 and HEAD.]
I think this results from a lot of the VM functions introducing native
methods. So I've just made a bunch of blank methods in a bunch of new
natVM*.cc files. I'll submit separate patches to fill in these methods
as I can. [I can fill in most of natVMMethod.cc and a good chunk of
natVMVirtualMachine.cc.]
Ok?
Keith
ChangeLog
2006-08-01 Keith Seitz <keiths@redhat.com>
* 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.
[-- Attachment #2: 091-merge.patch --]
[-- Type: text/x-patch, Size: 18730 bytes --]
Index: Makefile.am
===================================================================
--- Makefile.am (revision 115841)
+++ Makefile.am (working copy)
@@ -771,6 +771,9 @@
## This lists all the C++ source files in subdirectories.
nat_source_files = \
gnu/classpath/natSystemProperties.cc \
+gnu/classpath/jdwp/natVMFrame.cc \
+gnu/classpath/jdwp/natVMMethod.cc \
+gnu/classpath/jdwp/natVMVirtualMachine.cc \
gnu/gcj/natCore.cc \
gnu/gcj/convert/JIS0208_to_Unicode.cc \
gnu/gcj/convert/JIS0212_to_Unicode.cc \
Index: gnu/classpath/jdwp/VMVirtualMachine.java
===================================================================
--- gnu/classpath/jdwp/VMVirtualMachine.java (revision 115841)
+++ gnu/classpath/jdwp/VMVirtualMachine.java (working copy)
@@ -62,7 +62,8 @@
*
* @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 @@
*
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* 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 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* @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 @@
* (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 @@
* @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 @@
* 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 @@
*
* @param kind the type of events to clear
*/
- public static void clearEvents (byte kind) { }
+ public static native void clearEvents (byte kind)
+ throws JdwpException;
}
Index: gnu/classpath/jdwp/VMFrame.java
===================================================================
--- gnu/classpath/jdwp/VMFrame.java (revision 115841)
+++ gnu/classpath/jdwp/VMFrame.java (working copy)
@@ -76,14 +76,14 @@
*
* @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,
Index: gnu/classpath/jdwp/VMIdManager.java
===================================================================
--- gnu/classpath/jdwp/VMIdManager.java (revision 115841)
+++ gnu/classpath/jdwp/VMIdManager.java (working copy)
@@ -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 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 @@
* <b>NOTE:</b> All IDs handled by the ID manager (all object and reference
* type IDs) are assumed to be of type <code>long</code>.
*
+ * <b>NOTE:</b> 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 @@
// 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 @@
/**
* 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 @@
/**
* Returns a new reference type id for the given class
*
- * @param clazz the <code>Class</code> 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 @@
id = new InterfaceReferenceTypeId ();
else
id = new ClassReferenceTypeId ();
+ id.setReference (ref);
synchronized (_ridLock)
{
id.setId (++_lastRid);
Index: gnu/classpath/jdwp/VMMethod.java
===================================================================
--- gnu/classpath/jdwp/VMMethod.java (revision 115841)
+++ gnu/classpath/jdwp/VMMethod.java (working copy)
@@ -103,17 +103,17 @@
/**
* 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 @@
* @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 @@
* @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
Index: gnu/classpath/jdwp/natVMMethod.cc
===================================================================
--- gnu/classpath/jdwp/natVMMethod.cc (revision 0)
+++ gnu/classpath/jdwp/natVMMethod.cc (revision 0)
@@ -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 <config.h>
+#include <gcj/cni.h>
+
+#include <gnu/classpath/jdwp/VMMethod.h>
+#include <gnu/classpath/jdwp/util/LineTable.h>
+#include <gnu/classpath/jdwp/util/VariableTable.h>
+
+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;
+}
Index: gnu/classpath/jdwp/natVMVirtualMachine.cc
===================================================================
--- gnu/classpath/jdwp/natVMVirtualMachine.cc (revision 0)
+++ gnu/classpath/jdwp/natVMVirtualMachine.cc (revision 0)
@@ -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 <config.h>
+#include <gcj/cni.h>
+
+#include <java/lang/Class.h>
+#include <java/lang/ClassLoader.h>
+#include <java/lang/Thread.h>
+#include <java/nio/ByteBuffer.h>
+#include <java/util/ArrayList.h>
+#include <java/util/Iterator.h>
+
+#include <gnu/classpath/jdwp/VMFrame.h>
+#include <gnu/classpath/jdwp/VMMethod.h>
+#include <gnu/classpath/jdwp/VMVirtualMachine.h>
+#include <gnu/classpath/jdwp/event/EventRequest.h>
+#include <gnu/classpath/jdwp/util/MethodResult.h>
+
+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::VMMethod *> *
+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;
+}
Index: gnu/classpath/jdwp/natVMFrame.cc
===================================================================
--- gnu/classpath/jdwp/natVMFrame.cc (revision 0)
+++ gnu/classpath/jdwp/natVMFrame.cc (revision 0)
@@ -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 <gcj/cni.h>
+
+#include <gnu/classpath/jdwp/VMFrame.h>
+
+using namespace java::lang;
+
+Object*
+gnu::classpath::jdwp::VMFrame::getValue (jint slot)
+{
+ return 0;
+}
+
+void
+gnu::classpath::jdwp::VMFrame::setValue (jint slot, Object* value)
+{
+}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA/JDWP] Update gnu/classpath/jdwp to Classpath 0.91
2006-08-01 18:12 [RFA/JDWP] Update gnu/classpath/jdwp to Classpath 0.91 Keith Seitz
@ 2006-08-01 22:14 ` Tom Tromey
2006-08-04 20:51 ` Keith Seitz
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2006-08-01 22:14 UTC (permalink / raw)
To: Keith Seitz; +Cc: java-patches
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
Keith> I think this results from a lot of the VM functions introducing native
Keith> methods. So I've just made a bunch of blank methods in a bunch of new
Keith> natVM*.cc files. I'll submit separate patches to fill in these methods
Keith> as I can. [I can fill in most of natVMMethod.cc and a good chunk of
Keith> natVMVirtualMachine.cc.]
Keith> Ok?
Yes, thanks for keeping on top of this.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA/JDWP] Update gnu/classpath/jdwp to Classpath 0.91
2006-08-01 22:14 ` Tom Tromey
@ 2006-08-04 20:51 ` Keith Seitz
0 siblings, 0 replies; 3+ messages in thread
From: Keith Seitz @ 2006-08-04 20:51 UTC (permalink / raw)
To: tromey; +Cc: java-patches
Tom Tromey wrote:
> Yes, thanks for keeping on top of this.
Okay, I've finally committed this.
Thanks,
Keith
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-08-04 20:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-01 18:12 [RFA/JDWP] Update gnu/classpath/jdwp to Classpath 0.91 Keith Seitz
2006-08-01 22:14 ` Tom Tromey
2006-08-04 20:51 ` Keith Seitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).