229 } |
229 } |
230 return JNI_OK; |
230 return JNI_OK; |
231 } |
231 } |
232 |
232 |
233 JNIEXPORT void JNICALL |
233 JNIEXPORT void JNICALL |
|
234 Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_instMeth(JNIEnv *env, jobject inst) { |
|
235 jvmtiError err; |
|
236 jobject obj = NULL; |
|
237 |
|
238 printf("\n Native instMeth: started\n"); |
|
239 |
|
240 // Test GetLocalInstance with native instance method instMeth() frame |
|
241 err = jvmti->GetLocalInstance(NULL, 0, &obj); |
|
242 printf(" Native instMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); |
|
243 if (err != JVMTI_ERROR_NONE) { |
|
244 printf("FAIL: GetLocalInstance failed to get instance for native instance method frame\n"); |
|
245 result = STATUS_FAILED; |
|
246 } |
|
247 if (env->IsSameObject(inst, obj) == JNI_FALSE) { |
|
248 printf("FAIL: GetLocalInstance returned unexpected instance for native instance method frame\n"); |
|
249 result = STATUS_FAILED; |
|
250 } |
|
251 |
|
252 // Test GetLocalInstance with java instance method meth01() frame |
|
253 err = jvmti->GetLocalInstance(NULL, 1, &obj); |
|
254 printf(" Native instMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); |
|
255 if (err != JVMTI_ERROR_NONE) { |
|
256 printf("FAIL: GetLocalInstance failed to get instance for java instance method frame\n"); |
|
257 result = STATUS_FAILED; |
|
258 } |
|
259 if (env->IsSameObject(inst, obj) == JNI_FALSE) { |
|
260 printf("FAIL: GetLocalInstance returned unexpected instance for java instance method frame\n"); |
|
261 result = STATUS_FAILED; |
|
262 } |
|
263 printf(" Native instMeth: finished\n\n"); |
|
264 } |
|
265 |
|
266 JNIEXPORT void JNICALL |
234 Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls) { |
267 Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls) { |
235 jvmtiError err; |
268 jvmtiError err; |
|
269 jobject obj = NULL; |
|
270 |
|
271 printf("\n Native getMeth: started\n"); |
236 |
272 |
237 if (jvmti == NULL) { |
273 if (jvmti == NULL) { |
238 printf("JVMTI client was not properly loaded!\n"); |
274 printf("JVMTI client was not properly loaded!\n"); |
239 result = STATUS_FAILED; |
275 result = STATUS_FAILED; |
240 return; |
276 return; |
259 if (err != JVMTI_ERROR_NONE) { |
295 if (err != JVMTI_ERROR_NONE) { |
260 printf("Failed to enable metod exit event: %s (%d)\n", |
296 printf("Failed to enable metod exit event: %s (%d)\n", |
261 TranslateError(err), err); |
297 TranslateError(err), err); |
262 result = STATUS_FAILED; |
298 result = STATUS_FAILED; |
263 } |
299 } |
|
300 |
|
301 // Test GetLocalInstance with native static method getMeth() frame |
|
302 err = jvmti->GetLocalInstance(NULL, 0, &obj); |
|
303 printf(" Native getMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); |
|
304 if (err != JVMTI_ERROR_INVALID_SLOT) { |
|
305 printf("FAIL: GetLocalInstance failed to return JVMTI_ERROR_INVALID_SLOT for native static method frame\n"); |
|
306 result = STATUS_FAILED; |
|
307 } |
|
308 |
|
309 // Test GetLocalInstance with java static method run() frame |
|
310 err = jvmti->GetLocalInstance(NULL, 1, &obj); |
|
311 printf(" Native getMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); |
|
312 if (err != JVMTI_ERROR_INVALID_SLOT) { |
|
313 printf("FAIL: GetLocalInstance failed to return JVMTI_ERROR_INVALID_SLOT for java static method frame\n"); |
|
314 result = STATUS_FAILED; |
|
315 } |
|
316 |
|
317 printf(" Native getMeth: finished\n\n"); |
264 fflush(stdout); |
318 fflush(stdout); |
265 } |
319 } |
266 |
320 |
267 JNIEXPORT void JNICALL |
321 JNIEXPORT void JNICALL |
268 Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_checkLoc(JNIEnv *env, |
322 Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_checkLoc(JNIEnv *env, |