natVMVirtualMachine.cc (getClassMethod): Change to use JVMTI.
authorKyle Galloway <kgallowa@redhat.com>
Fri, 4 May 2007 19:48:33 +0000 (19:48 +0000)
committerKyle Galloway <kgallowa@gcc.gnu.org>
Fri, 4 May 2007 19:48:33 +0000 (19:48 +0000)
2007-05-04  Kyle Galloway  <kgallowa@redhat.com>

* gnu/classpath/jdwp/natVMVirtualMachine.cc (getClassMethod): Change
to use JVMTI.

From-SVN: r124447

libjava/ChangeLog
libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc

index c0a2a82..427d09e 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-04  Kyle Galloway  <kgallowa@redhat.com>
+
+       * gnu/classpath/jdwp/natVMVirtualMachine.cc (getClassMethod): Change
+       to use JVMTI.
+
 2007-05-03  Keith Seitz  <keiths@redhat.com>
 
        * interpret.cc: Don't include ExceptionEvent.h.
index d6edf34..3c89b98 100644 (file)
@@ -510,12 +510,25 @@ gnu::classpath::jdwp::VMMethod *
 gnu::classpath::jdwp::VMVirtualMachine::
 getClassMethod (jclass klass, jlong id)
 {
-  jmethodID method = reinterpret_cast<jmethodID> (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);
+
+  jmethodID meth_id = reinterpret_cast<jmethodID> (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<jlong> (meth_id));
+    }
 
-  throw new gnu::classpath::jdwp::exception::InvalidMethodException (id);
+  throw new exception::InvalidMethodException (id);
 }
 
 java::util::ArrayList *