From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../libjava.jvmti/interp/natgetlocalvartable.cc | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc (limited to 'libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc') diff --git a/libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc b/libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc new file mode 100644 index 000000000..8899bac3b --- /dev/null +++ b/libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc @@ -0,0 +1,70 @@ +#include + +#include +#include +#include + +#include "getlocalvartable.h" + +JNIEXPORT jint JNICALL Java_getlocalvartable_do_1getlocalvartable_1tests +(JNIEnv *env, jclass klass) +{ + JavaVM *vm; + jint err = env->GetJavaVM (&vm); + if (err < 0) + { + fprintf (stderr, "error getting VM\n"); + exit (1); + } + + jvmtiEnv *jvmti = NULL; + vm->GetEnv ((void **) &jvmti, JVMTI_VERSION_1_0); + + if (jvmti == NULL) + { + fprintf (stderr, "error getting jvmti environment\n"); + exit (1); + } + + jint entrys; + jvmtiLocalVariableEntry *var_table; + + jvmtiError jerr; + + jmethodID meth_ids[3]; + + meth_ids[0] = env->GetMethodID (klass, "aMethod", "(FF)D"); + meth_ids[1] = env->GetMethodID (klass, "bMethod", "(II)J"); + meth_ids[2] = env->GetMethodID (klass, "cMethod", + "(Ljava/lang/Object;)Ljava/lang/Object;"); + for (int i = 0; i < 3; i++) + { + jerr = jvmti->GetLocalVariableTable (meth_ids[i], &entrys, &var_table); + if (jerr != JVMTI_ERROR_NONE) + { + char *error_name; + jvmti->GetErrorName (jerr, &error_name); + fprintf (stderr, "JVMTI Error: %s\n", error_name); + jvmti->Deallocate (reinterpret_cast (error_name)); + } + else + { + for (int j = 0; j < entrys; j++) + { + printf ("Slot: %d\n", static_cast (var_table[j].slot)); + printf (" Name: %s\n", var_table[j].name); + jvmti->Deallocate (reinterpret_cast (var_table[j].name)); + printf (" Sig: %s\n", var_table[j].signature); + jvmti->Deallocate (reinterpret_cast (var_table[j].signature)); + printf (" Gen Sig: %s\n", var_table[j].generic_signature); + jvmti->Deallocate (reinterpret_cast (var_table[j].generic_signature)); + printf (" Start Loc: %ld\n", static_cast (var_table[j].start_location)); + printf (" Length: %d\n", static_cast (var_table[j].length)); + } + + jvmti->Deallocate (reinterpret_cast (var_table)); + } + } + + return 0; +} -- cgit v1.2.3