8295427: popframe004: report more details on error

Reviewed-by: cjplummer, lmesnik, sspitsyn
This commit is contained in:
Alex Menkov 2022-10-22 00:18:39 +00:00
parent 902162ca9f
commit 6acbdb59da

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
#include "jvmti.h"
#include "agent_common.h"
#include "JVMTITools.h"
#include "jvmti_common.h"
extern "C" {
@ -120,7 +121,7 @@ int resThread(jobject susThr) {
JNIEXPORT jint JNICALL
Java_nsk_jvmti_PopFrame_popframe004_doPopFrame(JNIEnv *env, jclass cls, jboolean otherThread,
jobject frameThr) {
jthread frameThr) {
jvmtiError err;
if (popDone) {
@ -152,6 +153,8 @@ Java_nsk_jvmti_PopFrame_popframe004_doPopFrame(JNIEnv *env, jclass cls, jboolean
tot_result = STATUS_FAILED;
}
bool gotError = false;
printf(">>>>>>>> Invoke PopFrame()\n");
fflush(stdout);
set_watch_ev(1); /* watch JVMTI events */
@ -160,7 +163,7 @@ Java_nsk_jvmti_PopFrame_popframe004_doPopFrame(JNIEnv *env, jclass cls, jboolean
switch (err) {
case JVMTI_ERROR_NONE:
printf("Check FAILED: PopFrame() was unexpectedly done\n");
tot_result = STATUS_FAILED;
gotError = true;
break;
case JVMTI_ERROR_NO_MORE_FRAMES:
case JVMTI_ERROR_OPAQUE_FRAME:
@ -173,7 +176,7 @@ Java_nsk_jvmti_PopFrame_popframe004_doPopFrame(JNIEnv *env, jclass cls, jboolean
printf("Check FAILED: PopFrame() returned unexpected error %d: %s\n",
err, TranslateError(err));
printf("\tFor more info about this error please refer to the JVMTI spec.\n");
tot_result = STATUS_FAILED;
gotError = true;
break;
}
@ -181,12 +184,17 @@ Java_nsk_jvmti_PopFrame_popframe004_doPopFrame(JNIEnv *env, jclass cls, jboolean
if (gen_ev) {
printf("TEST FAILED: %d JVMTI events were generated by the function PopFrame()\n",
gen_ev);
tot_result = STATUS_FAILED;
gotError = true;
} else {
printf("Check PASSED: No JVMTI events were generated by the function PopFrame()\n");
fflush(stdout);
}
if (gotError) {
tot_result = STATUS_FAILED;
print_stack_trace(jvmti, env, frameThr);
}
if (otherThread) { /* we are in a different thread */
return resThread(frameThr);
} else {