32 #include "native/include/gnu_classpath_jdwp_VMMethod.h"
35 #include "native/jvmti/VMjdwp.h"
42 (*jvmtienv)->GetErrorName(
jvmtienv,err, &errdesc);
43 fprintf(stderr,
"%s: jvmti error %s\n",desc, errdesc);
45 (*jvmtienv)->Deallocate(
jvmtienv,(
unsigned char*)errdesc);
63 (jmethodID)(
long)this->_methodId,
69 stringname = (*env)->NewStringUTF(env,name);
70 (*jvmtienv)->Deallocate(
jvmtienv,(
unsigned char*)name);
89 (jmethodID)(
long)this->_methodId,
90 NULL, &signature, NULL))) {
95 stringsignature = (*env)->NewStringUTF(env,signature);
96 (*jvmtienv)->Deallocate(
jvmtienv,(
unsigned char*)signature);
98 return stringsignature;
114 (jmethodID)(
long)this->_methodId,
146 (jmethodID)(
long)this->_methodId,
152 cl = (*env)->FindClass(env,
"gnu.classpath.jdwp.util.LineTable");
153 if (!cl)
return NULL;
155 m = (*env)->GetMethodID(env, cl,
"<init>",
"(JJ[I[J)V");
158 jlineNum = (*env)->NewIntArray(env, count);
159 if (!jlineNum)
return NULL;
160 jlineCI = (*env)->NewLongArray(env, count);
161 if (!jlineCI)
return NULL;
162 lineNum = (*env)->GetIntArrayElements(env, jlineNum, NULL);
163 lineCI = (*env)->GetLongArrayElements(env, jlineCI, NULL);
164 for (
i = 0;
i < count; ++
i) {
168 (*env)->ReleaseLongArrayElements(env, jlineCI, lineCI, 0);
169 (*env)->ReleaseIntArrayElements(env, jlineNum, lineNum, 0);
170 (*jvmtienv)->Deallocate(
jvmtienv, lne);
174 (jmethodID)(
long)this->_methodId,
180 ol = (*env)->NewObject(env, cl, m, start,
181 end, jlineNum, jlineCI);
183 return (
struct gnu_classpath_jdwp_util_LineTable*)ol;
191 jint *lengths, *
slot,
i;
195 *jlineCI = (*env)->NewLongArray(env, count);
196 if (!*jlineCI)
return false;
198 cl=(*env)->FindClass(env,
"java/lang/String");
199 if (!cl)
return false;
201 *names = (*env)->NewObjectArray(env, count, cl, NULL);
202 if (names)
return false;
203 sigs = (*env)->NewObjectArray(env, count, cl, NULL);
204 if (sigs)
return false;
206 jlengths = (*env)->NewIntArray(env, count);
207 if (!lengths)
return false;
209 jslot = (*env)->NewIntArray(env, count);
210 if (!slot)
return false;
212 lineCI = (*env)->GetLongArrayElements(env, *jlineCI, NULL);
213 lengths = (*env)->GetIntArrayElements(env, *jlengths, NULL);
214 slot = (*env)->GetIntArrayElements(env, jslot, NULL);
216 for (i=0; i<count; i++) {
218 SetObjectArrayElement(env, *names, i,
219 (*env)->NewStringUTF(env,entries[i].
name));
221 SetObjectArrayElement(env, *sigs, i, (*env)->NewStringUTF(
227 (*env)->ReleaseLongArrayElements(env, jlineCI, lineCI, 0);
228 (*env)->ReleaseIntArrayElements(env, jlengths, lengths, 0);
229 (*env)->ReleaseIntArrayElements(env, jslot, slot, 0);
242 jint entry_count, argCnt, slots;
244 jmethodID m, vmmethodid;
251 vmmethodid = (jmethodID)(
long)this->_methodId;
253 err= (*jvmtienv)->GetLocalVariableTable(
jvmtienv,
262 names = sigs = jlineCI = jlengths = jslot = NULL;
264 printjvmtierror(
"VMMethod.getVariableTable GetLocalVariableTable",err);
269 (*jvmtienv)->GetArgumentsSize(
jvmtienv,
283 slots = slots - argCnt;
285 &names, &sigs, &jlengths, &jslot))
296 (*jvmtienv)->Deallocate(
jvmtienv,(
unsigned char*)localvarentries);
299 cl = (*env)->FindClass(env,
"gnu.classpath.jdwp.util.VariableTable");
300 if (!cl)
return NULL;
303 GetMethodID(env, cl,
"<init>",
304 "(II[J[Ljava/lang/String;[Ljava/lang/String;[I[I)V");
307 o = (*env)->NewObject(env, cl, m, argCnt, slots, jlineCI,
308 names, sigs, jlengths, jslot);
310 return (
struct gnu_classpath_jdwp_util_VariableTable*) o;
jlong jlong jlong jlong jint jmethodID jint slot
static jvmtiError GetMethodModifiers(jvmtiEnv *env, jmethodID method, jint *modifiers_ptr)
static jvmtiError GetMethodLocation(jvmtiEnv *env, jmethodID method, jlocation *start_location_ptr, jlocation *end_location_ptr)
JNIEXPORT struct gnu_classpath_jdwp_util_VariableTable *JNICALL Java_gnu_classpath_jdwp_VMMethod_getVariableTable(JNIEnv *env, struct gnu_classpath_jdwp_VMMethod *this)
JNIEnv jclass jobject const char * name
static jvmtiError Deallocate(jvmtiEnv *env, unsigned char *mem)
static jvmtiError GetMethodName(jvmtiEnv *env, jmethodID method, char **name_ptr, char **signature_ptr, char **generic_ptr)
void printjvmtierror(char *desc, jvmtiError err)
GNU Classpath java/lang/String.
JNIEXPORT struct gnu_classpath_jdwp_util_LineTable *JNICALL Java_gnu_classpath_jdwp_VMMethod_getLineTable(JNIEnv *env, struct gnu_classpath_jdwp_VMMethod *this)
JNIEXPORT struct java_lang_String *JNICALL Java_gnu_classpath_jdwp_VMMethod_getName(JNIEnv *env, gnu_classpath_jdwp_VMMethod *this)
JNIEXPORT struct java_lang_String *JNICALL Java_gnu_classpath_jdwp_VMMethod_getSignature(JNIEnv *env, gnu_classpath_jdwp_VMMethod *this)
alloc::map< PassInfo::IDTy, const char * >::type names
static jvmtiError GetLineNumberTable(jvmtiEnv *env, jmethodID method, jint *entry_count_ptr, jvmtiLineNumberEntry **table_ptr)
static bool fillVariableTable(JNIEnv *env, jvmtiLocalVariableEntry *entries, int count, jlongArray *jlineCI, jobjectArray *names, jobjectArray *sigs, jintArray *jlengths, jintArray *jslot)
JNIEXPORT int32_t JNICALL Java_gnu_classpath_jdwp_VMMethod_getModifiers(JNIEnv *env, gnu_classpath_jdwp_VMMethod *this)