This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[RFA] VMVirtualMachine.getAllClassMethods
- From: Keith Seitz <keiths at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Wed, 24 Jan 2007 12:25:19 -0800
- Subject: [RFA] VMVirtualMachine.getAllClassMethods
Hello,
The attached patch implements the JDWP VMVirtualMachine method
getAllClassMethods. It's pretty simple: it just calls the JVMTI method
GetClassMethods and massages the result a little.
Ok?
Keith
ChangeLog
2007-01-24 Keith Seitz <keiths@redhat.com>
* gnu/classpath/jdwp/natVMVirtualMachine.cc
(getAllClassMethods): Implement.
Index: gnu/classpath/jdwp/natVMVirtualMachine.cc
===================================================================
--- gnu/classpath/jdwp/natVMVirtualMachine.cc (revision 121081)
+++ gnu/classpath/jdwp/natVMVirtualMachine.cc (working copy)
@@ -301,9 +301,39 @@
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 *