From 6ad151d09623217699d3d21c36d4e01f3bfd7d7b Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Tue, 27 Sep 2022 21:20:41 +0000 Subject: [PATCH] 8293143: Workaround for JDK-8292217 when doing "step over" of bytecode with unresolved cp reference Reviewed-by: sspitsyn, amenkov --- .../share/native/libjdwp/eventHandler.c | 11 ++++++++--- test/jdk/com/sun/jdi/CLETest.java | 13 +++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c b/src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c index 26c11ea6501..19eb801362d 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c @@ -334,9 +334,14 @@ deferEventReport(JNIEnv *env, jthread thread, jlocation end; error = methodLocation(method, &start, &end); if (error == JVMTI_ERROR_NONE) { - deferring = isBreakpointSet(clazz, method, start) || - threadControl_getInstructionStepMode(thread) - == JVMTI_ENABLE; + if (isBreakpointSet(clazz, method, start)) { + deferring = JNI_TRUE; + } else { + StepRequest* step = threadControl_getStepRequest(thread); + if (step->pending && step->depth == JDWP_STEP_DEPTH(INTO)) { + deferring = JNI_TRUE; + } + } if (!deferring) { threadControl_saveCLEInfo(env, thread, ei, clazz, method, start); diff --git a/test/jdk/com/sun/jdi/CLETest.java b/test/jdk/com/sun/jdi/CLETest.java index fd5d8c23d57..d4bcec90418 100644 --- a/test/jdk/com/sun/jdi/CLETest.java +++ b/test/jdk/com/sun/jdi/CLETest.java @@ -215,10 +215,15 @@ public class CLETest extends TestScaffold { // more than one Event in it. if (set.size() != 1) { testcaseFailed = true; - // For now, we expect these two test cases to fail due to 8292217, - // so don't fail the overall test run as a result of these failures. - // testFailed = true; - System.out.println("TESTCASE #" + testcase + " FAILED (ignoring): too many events in EventSet: " + set.size()); + // For now, we expect the 2nd test cases to fail due to 8292217, + // so don't fail the overall test run as a result of this failure. + // There is a workaround in place that allows the 1st test case to pass. + if (testcase == 1) { + testFailed = true; + } + System.out.println("TESTCASE #" + testcase + " FAILED" + + (testcase == 2 ? "(ignoring)" : "") + + ": too many events in EventSet: " + set.size()); } break; }