7 #include "getargssize.h"
9 JNIEXPORT jint JNICALL Java_getargssize_do_1getargssize_1tests
10 (JNIEnv *env, jclass klass)
13 jint err = env->GetJavaVM (&vm);
16 fprintf (stderr, "error getting VM\n");
20 jvmtiEnv *jvmti = NULL;
21 vm->GetEnv ((void **) &jvmti, JVMTI_VERSION_1_0);
25 fprintf (stderr, "error getting jvmti environment\n");
33 jmethodID meth_ids[4];
35 meth_ids[0] = env->GetMethodID (klass, "aMethod", "(FI)I");
36 meth_ids[1] = env->GetMethodID (klass, "bMethod", "(JDI)J");
37 meth_ids[2] = env->GetStaticMethodID (klass, "cMethod", "()Z");
38 meth_ids[3] = env->GetStaticMethodID (klass, "dMethod",
39 "(Ljava/lang/Object;)Ljava/lang/Object;");
40 for (int i = 0; i < 4; i++)
42 jerr = jvmti->GetArgumentsSize (meth_ids[i], &args_size);
43 if (jerr != JVMTI_ERROR_NONE)
46 jvmti->GetErrorName (jerr, &error_name);
47 fprintf (stderr, "JVMTI Error: %s\n", error_name);
48 jvmti->Deallocate (reinterpret_cast<unsigned char *> (error_name));
52 printf ("Method %d requires %d slots for its arguments\n", i,