diff options
author | Kyle Galloway <kgallowa@redhat.com> | 2007-02-08 18:21:00 +0000 |
---|---|---|
committer | Kyle Galloway <kgallowa@gcc.gnu.org> | 2007-02-08 18:21:00 +0000 |
commit | 0588f8c8db031785f71616191b72e8df4de07532 (patch) | |
tree | 130de2f63f3612d6cfd4bc1a0fa9b273b6863f31 | |
parent | e9105edd8c0478538778b5d1d2345ee8e9519783 (diff) | |
download | gcc-0588f8c8db031785f71616191b72e8df4de07532.zip gcc-0588f8c8db031785f71616191b72e8df4de07532.tar.gz gcc-0588f8c8db031785f71616191b72e8df4de07532.tar.bz2 |
StackFrameCommandSet.java (executeGetValues): Pass jlong instead of ByteBuffer.
2007-02-08 Kyle Galloway <kgallowa@redhat.com>
* classpath/gnu/classpath/jdwp/processor/
StackFrameCommandSet.java (executeGetValues): Pass jlong instead
of ByteBuffer.
(executeSetValues): Ditto.
(executeThisObject): Ditto.
* classpath/gnu/classpath/jdwp/processor/
StackFrameCommandSet.class: Rebuilt.
* classpath/lib/gnu/classpath/jdwp/VMVirtualMachine.class:
Rebuilt.
* classpath/lib/gnu/classpath/jdwp/VMFrame.class: Rebuilt.
* classpath/lib/gnu/classpath/jdwp/exception/
InvalidFrameException.java: New file.
* gnu/classpath/jdwp/VMFrame.java: Added field for thread of
frame.
(Constructor): New method.
* gnu/classpath/jdwp/VMFrame.h: Regenerated.
* gnu/classpath/jdwp/VMVirtualMachine.java
(getFrame): Changed ByteBuffer to jlong.
* gnu/classpath/jdwp/natVMVirtualMachine.cc
(getFrame): Implement.
* gnu/classpath/jdwp/VMVirtualMachine.h: Regenerated.
From-SVN: r121719
-rw-r--r-- | libjava/ChangeLog | 26 | ||||
-rw-r--r-- | libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java | 11 | ||||
-rw-r--r-- | libjava/classpath/lib/gnu/classpath/jdwp/VMFrame.class | bin | 837 -> 1131 bytes | |||
-rw-r--r-- | libjava/classpath/lib/gnu/classpath/jdwp/VMVirtualMachine.class | bin | 2883 -> 2863 bytes | |||
-rw-r--r-- | libjava/classpath/lib/gnu/classpath/jdwp/exception/InvalidFrameException.class | bin | 0 -> 799 bytes | |||
-rw-r--r-- | libjava/classpath/lib/gnu/classpath/jdwp/processor/StackFrameCommandSet.class | bin | 3406 -> 3489 bytes | |||
-rw-r--r-- | libjava/gnu/classpath/jdwp/VMFrame.h | 5 | ||||
-rw-r--r-- | libjava/gnu/classpath/jdwp/VMFrame.java | 29 | ||||
-rw-r--r-- | libjava/gnu/classpath/jdwp/VMVirtualMachine.h | 68 | ||||
-rw-r--r-- | libjava/gnu/classpath/jdwp/VMVirtualMachine.java | 4 | ||||
-rw-r--r-- | libjava/gnu/classpath/jdwp/exception/InvalidFrameException.h | 36 | ||||
-rw-r--r-- | libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc | 49 |
12 files changed, 177 insertions, 51 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index e3fc132..315912d 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,4 +1,28 @@ -2007-02-07 Kyle Galloway <kgallowa@redhat.com> +2007-02-08 Kyle Galloway <kgallowa@redhat.com> + + * classpath/gnu/classpath/jdwp/processor/ + StackFrameCommandSet.java (executeGetValues): Pass jlong instead + of ByteBuffer. + (executeSetValues): Ditto. + (executeThisObject): Ditto. + * classpath/gnu/classpath/jdwp/processor/ + StackFrameCommandSet.class: Rebuilt. + * classpath/lib/gnu/classpath/jdwp/VMVirtualMachine.class: + Rebuilt. + * classpath/lib/gnu/classpath/jdwp/VMFrame.class: Rebuilt. + * classpath/lib/gnu/classpath/jdwp/exception/ + InvalidFrameException.java: New file. + * gnu/classpath/jdwp/VMFrame.java: Added field for thread of + frame. + (Constructor): New method. + * gnu/classpath/jdwp/VMFrame.h: Regenerated. + * gnu/classpath/jdwp/VMVirtualMachine.java + (getFrame): Changed ByteBuffer to jlong. + * gnu/classpath/jdwp/natVMVirtualMachine.cc + (getFrame): Implement. + * gnu/classpath/jdwp/VMVirtualMachine.h: Regenerated. + +2007-02-08 Kyle Galloway <kgallowa@redhat.com> * include/java-interp.h (_Jv_InterpFrame): obj_ptr field added to hold "this" pointer for frame. diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java index 7890a8e..cf1e8c2 100644 --- a/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java +++ b/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java @@ -1,5 +1,5 @@ /* StackFrameCommandSet.java -- class to implement the StackFrame Command Set - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2007 Free Software Foundation This file is part of GNU Classpath. @@ -107,7 +107,8 @@ public class StackFrameCommandSet // 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 @@ public class StackFrameCommandSet 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 @@ public class StackFrameCommandSet 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); diff --git a/libjava/classpath/lib/gnu/classpath/jdwp/VMFrame.class b/libjava/classpath/lib/gnu/classpath/jdwp/VMFrame.class Binary files differindex 40c8c2d..10e2841 100644 --- a/libjava/classpath/lib/gnu/classpath/jdwp/VMFrame.class +++ b/libjava/classpath/lib/gnu/classpath/jdwp/VMFrame.class diff --git a/libjava/classpath/lib/gnu/classpath/jdwp/VMVirtualMachine.class b/libjava/classpath/lib/gnu/classpath/jdwp/VMVirtualMachine.class Binary files differindex 7b7be23..526d30b 100644 --- a/libjava/classpath/lib/gnu/classpath/jdwp/VMVirtualMachine.class +++ b/libjava/classpath/lib/gnu/classpath/jdwp/VMVirtualMachine.class diff --git a/libjava/classpath/lib/gnu/classpath/jdwp/exception/InvalidFrameException.class b/libjava/classpath/lib/gnu/classpath/jdwp/exception/InvalidFrameException.class Binary files differnew file mode 100644 index 0000000..9bdf078 --- /dev/null +++ b/libjava/classpath/lib/gnu/classpath/jdwp/exception/InvalidFrameException.class diff --git a/libjava/classpath/lib/gnu/classpath/jdwp/processor/StackFrameCommandSet.class b/libjava/classpath/lib/gnu/classpath/jdwp/processor/StackFrameCommandSet.class Binary files differindex 9e8d2a0..5b8fa18 100644 --- a/libjava/classpath/lib/gnu/classpath/jdwp/processor/StackFrameCommandSet.class +++ b/libjava/classpath/lib/gnu/classpath/jdwp/processor/StackFrameCommandSet.class diff --git a/libjava/gnu/classpath/jdwp/VMFrame.h b/libjava/gnu/classpath/jdwp/VMFrame.h index 5278a19..8181f86 100644 --- a/libjava/gnu/classpath/jdwp/VMFrame.h +++ b/libjava/gnu/classpath/jdwp/VMFrame.h @@ -29,7 +29,7 @@ class gnu::classpath::jdwp::VMFrame : public ::java::lang::Object { public: - VMFrame(); + VMFrame(::java::lang::Thread *, jlong, ::gnu::classpath::jdwp::util::Location *); virtual ::gnu::classpath::jdwp::util::Location * getLocation(); virtual ::java::lang::Object * getValue(jint); virtual void setValue(jint, ::java::lang::Object *); @@ -37,7 +37,8 @@ public: virtual jlong getId(); static const jint SIZE = 8; private: - ::java::lang::Object * __attribute__((aligned(__alignof__( ::java::lang::Object)))) obj; + ::java::lang::Thread * __attribute__((aligned(__alignof__( ::java::lang::Object)))) thread; + ::java::lang::Object * obj; ::gnu::classpath::jdwp::util::Location * loc; jlong id; public: diff --git a/libjava/gnu/classpath/jdwp/VMFrame.java b/libjava/gnu/classpath/jdwp/VMFrame.java index cd21302..e0f093f 100644 --- a/libjava/gnu/classpath/jdwp/VMFrame.java +++ b/libjava/gnu/classpath/jdwp/VMFrame.java @@ -1,5 +1,5 @@ /* VMFrame.java -- Reference implementation of VM hooks for JDWP Frame access. - Copyright (C) 2005, 2006 Free Software Foundation + Copyright (C) 2005, 2006, 2007 Free Software Foundation This file is part of GNU Classpath. @@ -54,7 +54,10 @@ public class VMFrame */ public static final int SIZE = 8; - // The object this frame resides in + // The thread this frame resides in + private Thread thread; + + //The object of this frame private Object obj; // The current location of this frame @@ -64,6 +67,20 @@ public class VMFrame 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 @@ public class VMFrame * @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, diff --git a/libjava/gnu/classpath/jdwp/VMVirtualMachine.h b/libjava/gnu/classpath/jdwp/VMVirtualMachine.h index a9a3b6d..b90b476 100644 --- a/libjava/gnu/classpath/jdwp/VMVirtualMachine.h +++ b/libjava/gnu/classpath/jdwp/VMVirtualMachine.h @@ -1,4 +1,3 @@ - // DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __gnu_classpath_jdwp_VMVirtualMachine__ @@ -17,59 +16,52 @@ extern "Java" { namespace jdwp { - class VMFrame; - class VMMethod; - class VMVirtualMachine; + class VMVirtualMachine; namespace event { - class EventRequest; + class EventRequest; } namespace util { - class MethodResult; + class MethodResult; } + class VMFrame; + class VMMethod; } } } - namespace java - { - namespace nio - { - class ByteBuffer; - } - } } class gnu::classpath::jdwp::VMVirtualMachine : public ::java::lang::Object { - public: - VMVirtualMachine(); - static void initialize(); - static void suspendThread(::java::lang::Thread *); - static void suspendAllThreads(); - static void resumeThread(::java::lang::Thread *); - static void resumeAllThreads(); - static jint getSuspendCount(::java::lang::Thread *); - static jint getAllLoadedClassesCount(); - static ::java::util::Iterator * getAllLoadedClasses(); - static jint getClassStatus(::java::lang::Class *); - static JArray< ::gnu::classpath::jdwp::VMMethod * > * getAllClassMethods(::java::lang::Class *); - static ::gnu::classpath::jdwp::VMMethod * getClassMethod(::java::lang::Class *, jlong); - static ::java::util::ArrayList * getFrames(::java::lang::Thread *, jint, jint); - static ::gnu::classpath::jdwp::VMFrame * getFrame(::java::lang::Thread *, ::java::nio::ByteBuffer *); - static jint getFrameCount(::java::lang::Thread *); - static jint getThreadStatus(::java::lang::Thread *); - static ::java::util::ArrayList * getLoadRequests(::java::lang::ClassLoader *); - static ::gnu::classpath::jdwp::util::MethodResult * executeMethod(::java::lang::Object *, ::java::lang::Thread *, ::java::lang::Class *, ::java::lang::reflect::Method *, JArray< ::java::lang::Object * > *, jboolean); - static ::java::lang::String * getSourceFile(::java::lang::Class *); - static void registerEvent(::gnu::classpath::jdwp::event::EventRequest *); - static void unregisterEvent(::gnu::classpath::jdwp::event::EventRequest *); - static void clearEvents(jbyte); + VMVirtualMachine (); + static void initialize (); + static void suspendThread (::java::lang::Thread *); + static void suspendAllThreads (); + static void resumeThread (::java::lang::Thread *); + static void resumeAllThreads (); + static jint getSuspendCount (::java::lang::Thread *); + static jint getAllLoadedClassesCount (); + static ::java::util::Iterator *getAllLoadedClasses (); + static jint getClassStatus (::java::lang::Class *); + static JArray< ::gnu::classpath::jdwp::VMMethod *> *getAllClassMethods (::java::lang::Class *); + static ::gnu::classpath::jdwp::VMMethod *getClassMethod (::java::lang::Class *, jlong); + static ::java::util::ArrayList *getFrames (::java::lang::Thread *, jint, jint); + static ::gnu::classpath::jdwp::VMFrame *getFrame (::java::lang::Thread *, jlong); + static jint getFrameCount (::java::lang::Thread *); + static jint getThreadStatus (::java::lang::Thread *); + static ::java::util::ArrayList *getLoadRequests (::java::lang::ClassLoader *); + static ::gnu::classpath::jdwp::util::MethodResult *executeMethod (::java::lang::Object *, ::java::lang::Thread *, ::java::lang::Class *, ::java::lang::reflect::Method *, JArray< ::java::lang::Object *> *, jboolean); + static ::java::lang::String *getSourceFile (::java::lang::Class *); + static void registerEvent (::gnu::classpath::jdwp::event::EventRequest *); + static void unregisterEvent (::gnu::classpath::jdwp::event::EventRequest *); + static void clearEvents (jbyte); private: - static ::java::util::Hashtable * _jdwp_suspend_counts; + static ::java::util::Hashtable *_jdwp_suspend_counts; public: + static ::java::lang::Class class$; }; -#endif // __gnu_classpath_jdwp_VMVirtualMachine__ +#endif /* __gnu_classpath_jdwp_VMVirtualMachine__ */ diff --git a/libjava/gnu/classpath/jdwp/VMVirtualMachine.java b/libjava/gnu/classpath/jdwp/VMVirtualMachine.java index 5c4018f..1b0f7f6 100644 --- a/libjava/gnu/classpath/jdwp/VMVirtualMachine.java +++ b/libjava/gnu/classpath/jdwp/VMVirtualMachine.java @@ -1,7 +1,7 @@ /* VMVirtualMachine.java -- A reference implementation of a JDWP virtual machine - Copyright (C) 2005, 2006 Free Software Foundation + Copyright (C) 2005, 2006, 2007 Free Software Foundation This file is part of GNU Classpath. @@ -243,7 +243,7 @@ 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, long frameID) throws JdwpException; /** diff --git a/libjava/gnu/classpath/jdwp/exception/InvalidFrameException.h b/libjava/gnu/classpath/jdwp/exception/InvalidFrameException.h new file mode 100644 index 0000000..abe84e0 --- /dev/null +++ b/libjava/gnu/classpath/jdwp/exception/InvalidFrameException.h @@ -0,0 +1,36 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_classpath_jdwp_exception_InvalidFrameException__ +#define __gnu_classpath_jdwp_exception_InvalidFrameException__ + +#pragma interface + +#include <gnu/classpath/jdwp/exception/JdwpException.h> +extern "Java" +{ + namespace gnu + { + namespace classpath + { + namespace jdwp + { + namespace exception + { + class InvalidFrameException; + } + } + } + } +} + +class gnu::classpath::jdwp::exception::InvalidFrameException : public ::gnu::classpath::jdwp::exception::JdwpException +{ + +public: + InvalidFrameException(jlong); + InvalidFrameException(::java::lang::String *); + static ::java::lang::Class class$; +}; + +#endif // __gnu_classpath_jdwp_exception_InvalidFrameException__ diff --git a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc index 208e689..ab11b3e 100644 --- a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc +++ b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc @@ -14,6 +14,8 @@ details. */ #include <jvm.h> #include <jvmti.h> +#include <java-interp.h> + #include <java/lang/Class.h> #include <java/lang/ClassLoader.h> #include <java/lang/Integer.h> @@ -21,6 +23,7 @@ details. */ #include <java/lang/StringBuilder.h> #include <java/lang/Thread.h> #include <java/nio/ByteBuffer.h> +#include <java/nio/ByteBufferImpl.h> #include <java/util/ArrayList.h> #include <java/util/Collection.h> #include <java/util/Hashtable.h> @@ -39,6 +42,7 @@ details. */ #include <gnu/classpath/jdwp/event/VmInitEvent.h> #include <gnu/classpath/jdwp/event/filters/IEventFilter.h> #include <gnu/classpath/jdwp/event/filters/LocationOnlyFilter.h> +#include <gnu/classpath/jdwp/exception/InvalidFrameException.h> #include <gnu/classpath/jdwp/exception/InvalidLocationException.h> #include <gnu/classpath/jdwp/exception/InvalidMethodException.h> #include <gnu/classpath/jdwp/exception/JdwpInternalErrorException.h> @@ -432,9 +436,50 @@ gnu::classpath::jdwp::VMVirtualMachine::getFrames (MAYBE_UNUSED Thread *thread, gnu::classpath::jdwp::VMFrame * gnu::classpath::jdwp::VMVirtualMachine:: -getFrame (MAYBE_UNUSED Thread *thread, MAYBE_UNUSED::java::nio::ByteBuffer *bb) +getFrame (Thread *thread, jlong frameID) { - return NULL; + using namespace gnu::classpath::jdwp::exception; + + _Jv_Frame *vm_frame = (_Jv_Frame *) thread->frame; + jint depth = 0; + _Jv_Frame *frame = reinterpret_cast<_Jv_Frame *> (frameID); + + // We need to find the stack depth of the frame, so search through the call + // stack to find it. This also checks for a valid frameID. + while (vm_frame != frame) + { + vm_frame = vm_frame->next; + depth++; + if (vm_frame == NULL) + throw new InvalidFrameException (frameID); + } + + Location *loc = NULL; + jvmtiFrameInfo info; + jvmtiError jerr; + jint num_frames; + jclass klass; + + // Get the info for the frame of interest + jerr = _jdwp_jvmtiEnv->GetStackTrace (thread, depth, 1, &info, &num_frames); + + if (jerr != JVMTI_ERROR_NONE) + throw_jvmti_error (jerr); + + jerr = _jdwp_jvmtiEnv->GetMethodDeclaringClass (info.method, &klass); + + if (jerr != JVMTI_ERROR_NONE) + throw_jvmti_error (jerr); + + VMMethod *meth + = getClassMethod (klass, reinterpret_cast<jlong> (info.method)); + + if (info.location == -1) + loc = new Location (meth, 0); + else + loc = new Location (meth, info.location); + + return new VMFrame (thread, reinterpret_cast<jlong> (vm_frame), loc); } jint |