From ddd3985ef531626ad904f1f2b7d72a07d72b6cd5 Mon Sep 17 00:00:00 2001 From: Kyle Galloway Date: Fri, 4 May 2007 19:48:33 +0000 Subject: [PATCH] natVMVirtualMachine.cc (getClassMethod): Change to use JVMTI. 2007-05-04 Kyle Galloway * gnu/classpath/jdwp/natVMVirtualMachine.cc (getClassMethod): Change to use JVMTI. From-SVN: r124447 --- libjava/ChangeLog | 5 ++++ .../gnu/classpath/jdwp/natVMVirtualMachine.cc | 23 +++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index c0a2a82a77e1..427d09ea2c4f 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2007-05-04 Kyle Galloway + + * gnu/classpath/jdwp/natVMVirtualMachine.cc (getClassMethod): Change + to use JVMTI. + 2007-05-03 Keith Seitz * interpret.cc: Don't include ExceptionEvent.h. diff --git a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc index d6edf3454370..3c89b9863ecd 100644 --- a/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc +++ b/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc @@ -510,12 +510,25 @@ gnu::classpath::jdwp::VMMethod * gnu::classpath::jdwp::VMVirtualMachine:: getClassMethod (jclass klass, jlong id) { - jmethodID method = reinterpret_cast (id); - _Jv_MethodBase *bmeth = _Jv_FindInterpreterMethod (klass, method); - if (bmeth != NULL) - return new gnu::classpath::jdwp::VMMethod (klass, id); + jint count; + jmethodID *methods; + jvmtiError err = _jdwp_jvmtiEnv->GetClassMethods (klass, &count, &methods); + if (err != JVMTI_ERROR_NONE) + throw_jvmti_error (err); - throw new gnu::classpath::jdwp::exception::InvalidMethodException (id); + jmethodID meth_id = reinterpret_cast (id); + + using namespace gnu::classpath::jdwp; + + // Check if this method is defined for the given class and if so return a + // VMMethod representing it. + for (int i = 0; i < count; i++) + { + if (methods[i] == meth_id) + return new VMMethod (klass, reinterpret_cast (meth_id)); + } + + throw new exception::InvalidMethodException (id); } java::util::ArrayList *