Skip to content

Commit a4c6a99

Browse files
committed
8252593: [TESTBUG] serviceability/jvmti/GetLocalVariable/GetLocalWithoutSuspendTest.java failed with JVMTI_ERROR_INVALID_SLOT
Reviewed-by: sspitsyn, cjplummer
1 parent a67f890 commit a4c6a99

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalWithoutSuspendTest.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void test_GetLocalObject(jvmtiEnv* jvmti, JNIEnv* env, int depth) {
154154
jobject obj;
155155
char* errMsg;
156156

157-
printf("AGENT: calling GetLocalObject()\n");
157+
printf("AGENT: calling GetLocalObject() with depth %d\n", depth);
158158
err = jvmti->GetLocalObject(target_thread, depth, 0, &obj);
159159
errMsg = GetErrorMessage(jvmti, err);
160160
printf("AGENT: GetLocalObject() result code %s (%d)\n", errMsg != NULL ? errMsg : "N/A", err);
@@ -166,9 +166,13 @@ void test_GetLocalObject(jvmtiEnv* jvmti, JNIEnv* env, int depth) {
166166
// If the target thread wins the race we can get errors because we
167167
// don't find a frame at the given depth or we find a non-java frame
168168
// there (e.g. native frame). This is expected.
169+
// JVMTI_ERROR_INVALID_SLOT can occur also because the target thread is
170+
// running and the GetLocalObject() call might coincidentally refer to the
171+
// frame of a static method without parameters.
169172
if (err != JVMTI_ERROR_NONE &&
170173
err != JVMTI_ERROR_NO_MORE_FRAMES &&
171-
err != JVMTI_ERROR_OPAQUE_FRAME) {
174+
err != JVMTI_ERROR_OPAQUE_FRAME &&
175+
err != JVMTI_ERROR_INVALID_SLOT) {
172176
ShowErrorMessage(jvmti, err, "AgentThreadLoop: error in JVMTI GetLocalObject");
173177
env->FatalError("AgentThreadLoop: error in JVMTI GetLocalObject\n");
174178
}
@@ -260,7 +264,7 @@ AgentThreadLoop(jvmtiEnv * jvmti, JNIEnv* env, void * arg) {
260264
// It notifies the agent to do the GetLocalObject() call and then races
261265
// it to make its stack not walkable by returning from the native call.
262266
JNIEXPORT void JNICALL
263-
Java_GetLocalWithoutSuspendTest_notifyAgentToGetLocal(JNIEnv *env, jclass cls, jint depth, jlong waitCycles) {
267+
Java_GetLocalWithoutSuspendTest_notifyAgentToGetLocal(JNIEnv *env, jclass cls, jint depth, jint waitCycles) {
264268
monitor_enter(jvmti, env, AT_LINE);
265269

266270
// Set depth_for_get_local and notify agent that the target thread is ready for the GetLocalObject() call

0 commit comments

Comments
 (0)