* gnu/classpath/jdwp/natVMVirtualMachine.cc
authorKeith Seitz <keiths@redhat.com>
Wed, 24 Jan 2007 22:35:43 +0000 (22:35 +0000)
committerKeith Seitz <kseitz@gcc.gnu.org>
Wed, 24 Jan 2007 22:35:43 +0000 (22:35 +0000)
        (getAllClassMethods): Implement.

From-SVN: r121142

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

index 18720f4f003f40c814b4f1e0d7c265f1a934c9e0..a69d1da2021344b200769790d36622aed1f5042d 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-24  Keith Seitz  <keiths@redhat.com>
+
+       * gnu/classpath/jdwp/natVMVirtualMachine.cc
+       (getAllClassMethods): Implement.
+
 2007-01-24  Andrew Haley  <aph@redhat.com>
 
        * gnu/classpath/natVMStackWalker.cc: Call InitClass everywhere.
index 84b75ec386cfa088eea78d9dd4435888bedca15b..afdfbc72cef98ceee14b82c5109fbbbf2ef5a7a2 100644 (file)
@@ -301,9 +301,39 @@ getClassStatus (MAYBE_UNUSED jclass klass)
 
 JArray<gnu::classpath::jdwp::VMMethod *> *
 gnu::classpath::jdwp::VMVirtualMachine::
-getAllClassMethods (MAYBE_UNUSED jclass klass)
+getAllClassMethods (jclass klass)
 {
-  return NULL;
+  jint count;
+  jmethodID *methods;
+  jvmtiError err = _jdwp_jvmtiEnv->GetClassMethods (klass, &count, &methods);
+  if (err != JVMTI_ERROR_NONE)
+    {
+      char *error;
+      jstring msg;
+      if (_jdwp_jvmtiEnv->GetErrorName (err, &error) != JVMTI_ERROR_NONE)
+       {
+         msg = JvNewStringLatin1 (error);
+         _jdwp_jvmtiEnv->Deallocate ((unsigned char *) error);
+       }
+      else
+       msg = JvNewStringLatin1 ("out of memory");
+
+      using namespace gnu::classpath::jdwp::exception;
+      throw new JdwpInternalErrorException (msg);
+    }
+
+  JArray<VMMethod *> *result
+    = (JArray<VMMethod *> *) JvNewObjectArray (count,
+                                              &VMMethod::class$, NULL);
+  VMMethod **rmeth = elements (result);
+  for (int i = 0; i < count; ++i)
+    {
+      jlong id = reinterpret_cast<jlong> (methods[i]);
+      rmeth[i] = getClassMethod (klass, id);
+    }
+
+  _jdwp_jvmtiEnv->Deallocate ((unsigned char *) methods);
+  return result;
 }
 
 gnu::classpath::jdwp::VMMethod *