From 0588f8c8db031785f71616191b72e8df4de07532 Mon Sep 17 00:00:00 2001 From: Kyle Galloway Date: Thu, 8 Feb 2007 18:21:00 +0000 Subject: [PATCH] StackFrameCommandSet.java (executeGetValues): Pass jlong instead of ByteBuffer. 2007-02-08 Kyle Galloway * 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 --- libjava/ChangeLog | 26 ++++++- .../jdwp/processor/StackFrameCommandSet.java | 11 +-- .../lib/gnu/classpath/jdwp/VMFrame.class | Bin 837 -> 1131 bytes .../gnu/classpath/jdwp/VMVirtualMachine.class | Bin 2883 -> 2863 bytes .../exception/InvalidFrameException.class | Bin 0 -> 799 bytes .../jdwp/processor/StackFrameCommandSet.class | Bin 3406 -> 3489 bytes libjava/gnu/classpath/jdwp/VMFrame.h | 5 +- libjava/gnu/classpath/jdwp/VMFrame.java | 29 +++++++- libjava/gnu/classpath/jdwp/VMVirtualMachine.h | 68 ++++++++---------- .../gnu/classpath/jdwp/VMVirtualMachine.java | 4 +- .../jdwp/exception/InvalidFrameException.h | 36 ++++++++++ .../gnu/classpath/jdwp/natVMVirtualMachine.cc | 49 ++++++++++++- 12 files changed, 177 insertions(+), 51 deletions(-) create mode 100644 libjava/classpath/lib/gnu/classpath/jdwp/exception/InvalidFrameException.class create mode 100644 libjava/gnu/classpath/jdwp/exception/InvalidFrameException.h diff --git a/libjava/ChangeLog b/libjava/ChangeLog index e3fc1325495..315912da911 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,4 +1,28 @@ -2007-02-07 Kyle Galloway +2007-02-08 Kyle Galloway + + * 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 * 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 7890a8e4b1b..cf1e8c272da 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 index 40c8c2da7c26af2f47bed32531f5185585b3a02d..10e284132fa3b6b6b9c5ddc84f8425b1eef20978 100644 GIT binary patch literal 1131 zcmah}%Wl&^6g}fO&7&@TkffyL(Ut;^3pK9=5{OMjrBtB>wTciMG)YY2$g!)$p<8|k z2_zyU7JL97g*am;C2cIR@Z3A&bIzT6uI1l%Gs0u9X1^ytEepr{@&`D7@D=-&! z`i^V~tknLIPolHu0;!*bxY96mJ-Ze(W#|Szp_)s5alm3PT;B~} z3OqAss~!Abs#0e|dqK;|BZZ=YWt4akvr^AN;F^IP@+w<1u!tp7eA@{ptqW|M zl_agp24zW#h9XcjtCcBl&h5?)&LJhUI*U-&R_+-b=2;Y^~Oic#b|qR0s` zW{6$J3fHUL^{A3&ELuNMuy#gRwKhg5TV;KO^=}dF2G>#qszJvg<&P-%1_ivuO}?{u z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%TE(g6vn@yojWtND2hXzA`w)ug+T%_ZBkUggo&t8j0PX^RbYT36ez>P2NZeZ z1E?2vY;fb6Xex1`Zgt^bpmF2I#OQyZo=%(5g~rXDdr#(k=lg#5t{1-d<-Pmy@)dw; ztV+lcP|cI>{N!cNMrDJ@*Tu5^S8!E;+-X`yJko0lX!M`zjtobtdLpsTs`FiOGtyqm zzq?fa!L9OTCMmTZTt`I04c;T}^0lH(0HgM%m?gmF4>WmTqEkW#FK0!;E<{OvBp$U) z`vWU7YY3(-KEE$iVMdi0b zLO>2YMCNSya~KsVoH$*XLh~E6gx#9EViOm`B2}*inXa-F+Fe2EDT?iiOl$WAO;qI+ zVqrzslucOElAuZ|TmSiKgG4jZHSp5jgn|z2Kny;LSd4y@VE_pogQ$Up5Qb2XVHi|w z#wfN>OGm~Twdc}_JmM(oAlSQlG?2W4CT0{s+g#QkccEiP^A{=AtPn z+;@n4{!OIZRvn|siE(m1L7pec?Gz!IfsR>nIfq(0H)7!r5{5&4e * 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 5c4018fce13..1b0f7f6fa3c 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 00000000000..abe84e0e4e0 --- /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 +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 208e689b79d..ab11b3ed299 100644 --- a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc +++ b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc @@ -14,6 +14,8 @@ details. */ #include #include +#include + #include #include #include @@ -21,6 +23,7 @@ details. */ #include #include #include +#include #include #include #include @@ -39,6 +42,7 @@ details. */ #include #include #include +#include #include #include #include @@ -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 (info.method)); + + if (info.location == -1) + loc = new Location (meth, 0); + else + loc = new Location (meth, info.location); + + return new VMFrame (thread, reinterpret_cast (vm_frame), loc); } jint -- 2.30.2