diff options
author | kseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-25 18:04:01 +0000 |
---|---|---|
committer | kseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-25 18:04:01 +0000 |
commit | c3eaf28fd1b4875d0d7aa8bb6f6a470bd013fb87 (patch) | |
tree | f4a5c5e2a3570b0db4fa58b4dfc90580cd568148 /libjava/jvmti.cc | |
parent | aafb162c86e447fe4def2b04045c8c2b1af540cb (diff) | |
download | gcc-c3eaf28fd1b4875d0d7aa8bb6f6a470bd013fb87.tar.gz |
* jvmti.cc (_Jv_JVMTI_GetMethodName): New function.
(_Jv_JVMTI_Interface): Define GetMethodName.
* testsuite/libjava.jvmti/getmethodname.java: New file.
* testsuite/libjava.jvmti/natgetmethodname.cc: New file.
* testsuite/libjava.jvmti/getmethodname.out: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121179 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jvmti.cc')
-rw-r--r-- | libjava/jvmti.cc | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/libjava/jvmti.cc b/libjava/jvmti.cc index 69cfda5ae75..f7329841747 100644 --- a/libjava/jvmti.cc +++ b/libjava/jvmti.cc @@ -568,6 +568,48 @@ _Jv_JVMTI_IsFieldSynthetic (MAYBE_UNUSED jvmtiEnv *env, jclass klass, } static jvmtiError JNICALL +_Jv_JVMTI_GetMethodName (MAYBE_UNUSED jvmtiEnv *env, jmethodID method, + char **name_ptr, char **signature_ptr, + char **generic_ptr) +{ + REQUIRE_PHASE (env, JVMTI_PHASE_START | JVMTI_PHASE_LIVE); + + if (method == NULL) + return JVMTI_ERROR_INVALID_METHODID; + + if (name_ptr != NULL) + { + int len = static_cast<int> (method->name->len ()); + *name_ptr = (char *) _Jv_MallocUnchecked (len + 1); + if (*name_ptr == NULL) + return JVMTI_ERROR_OUT_OF_MEMORY; + strncpy (*name_ptr, method->name->chars (), len); + (*name_ptr)[len] = '\0'; + } + + if (signature_ptr != NULL) + { + int len = static_cast<int> (method->signature->len ()); + *signature_ptr = (char *) _Jv_MallocUnchecked (len + 1); + if (*signature_ptr == NULL) + { + if (name_ptr != NULL) + _Jv_Free (*name_ptr); + return JVMTI_ERROR_OUT_OF_MEMORY; + } + strncpy (*signature_ptr, method->signature->chars (), len); + (*signature_ptr)[len] = '\0'; + } + + if (generic_ptr != NULL) + { + *generic_ptr = NULL; + } + + return JVMTI_ERROR_NONE; +} + +static jvmtiError JNICALL _Jv_JVMTI_GetMethodModifiers (MAYBE_UNUSED jvmtiEnv *env, jmethodID method, jint *result) { @@ -1497,7 +1539,7 @@ struct _Jv_jvmtiEnv _Jv_JVMTI_Interface = UNIMPLEMENTED, // GetFieldDeclaringClass _Jv_JVMTI_GetFieldModifiers, // GetFieldModifiers _Jv_JVMTI_IsFieldSynthetic, // IsFieldSynthetic - UNIMPLEMENTED, // GetMethodName + _Jv_JVMTI_GetMethodName, // GetMethodName _Jv_JVMTI_GetMethodDeclaringClass, // GetMethodDeclaringClass _Jv_JVMTI_GetMethodModifiers, // GetMethodModifers RESERVED, // reserved67 |