diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index f17fc2eb9d00..9ca3f3b1bdf6 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -1127,7 +1127,7 @@ debugger.filter.breakpoints.during.stepping.using.debugger.engine.description=Wh debugger.filter.breakpoints.by.coroutine.id=false debugger.filter.breakpoints.by.coroutine.id.description=When enabled uses unique coroutine id to filter stepping -debugger.filter.breakpoints.by.coroutine.id.with.evaluation=false +debugger.filter.breakpoints.by.coroutine.id.with.evaluation=true debugger.filter.breakpoints.by.coroutine.id.with.evaluation.description=Use code fragment evaluation to extract coroutine id wolf.the.problem.solver=true diff --git a/plugins/kotlin/jvm-debugger/coroutines/src/org/jetbrains/kotlin/idea/debugger/coroutine/CoroutineStackFrameInterceptor.kt b/plugins/kotlin/jvm-debugger/coroutines/src/org/jetbrains/kotlin/idea/debugger/coroutine/CoroutineStackFrameInterceptor.kt index c433b6330ebe..783706f47132 100644 --- a/plugins/kotlin/jvm-debugger/coroutines/src/org/jetbrains/kotlin/idea/debugger/coroutine/CoroutineStackFrameInterceptor.kt +++ b/plugins/kotlin/jvm-debugger/coroutines/src/org/jetbrains/kotlin/idea/debugger/coroutine/CoroutineStackFrameInterceptor.kt @@ -69,16 +69,18 @@ class CoroutineStackFrameInterceptor(val project: Project) : StackFrameIntercept if (Registry.`is`("debugger.filter.breakpoints.by.coroutine.id.with.evaluation") && !useContinuationObjectFilter.get(suspendContext.debugProcess, false)) { - val coroutineId = extractContinuationId(evaluationContext) - if (coroutineId != null) { - if (coroutineId <= 0L) return null - return ContinuationIdFilter(coroutineId) + try { + val coroutineId = extractContinuationId(evaluationContext) + if (coroutineId != null) { + if (coroutineId <= 0L) return null + return ContinuationIdFilter(coroutineId) + } } - else { - useContinuationObjectFilter.set(suspendContext.debugProcess, true) - thisLogger().error("Cannot extract continuation from thread") + catch (e: EvaluateException) { + // go lower } - + useContinuationObjectFilter.set(suspendContext.debugProcess, true) + thisLogger().error("Cannot extract continuation from thread") } val defaultExecutionContext = DefaultExecutionContext(evaluationContext) return continuationObjectFilter(suspendContext, defaultExecutionContext) diff --git a/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameJobCompletionOnly.kt b/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameJobCompletionOnly.kt index 1a93b99ba57e..bd81f21f0f4a 100644 --- a/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameJobCompletionOnly.kt +++ b/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameJobCompletionOnly.kt @@ -1,5 +1,5 @@ // ATTACH_LIBRARY: maven(org.jetbrains.kotlinx:kotlinx-coroutines-debug:1.6.4)-javaagent -// REGISTRY: debugger.filter.breakpoints.by.coroutine.id=true + package runToCursorSuspendSameJobCompletionOnly import kotlinx.coroutines.GlobalScope @@ -35,3 +35,6 @@ suspend fun endMethod(k: Int) { // RUN_TO_CURSOR: 1 delay(1) } + +// REGISTRY: debugger.filter.breakpoints.by.coroutine.id=true +// REGISTRY: debugger.filter.breakpoints.by.coroutine.id.with.evaluation=false diff --git a/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameJobContinuation.kt b/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameJobContinuation.kt index 1a93b99ba57e..bd81f21f0f4a 100644 --- a/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameJobContinuation.kt +++ b/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameJobContinuation.kt @@ -1,5 +1,5 @@ // ATTACH_LIBRARY: maven(org.jetbrains.kotlinx:kotlinx-coroutines-debug:1.6.4)-javaagent -// REGISTRY: debugger.filter.breakpoints.by.coroutine.id=true + package runToCursorSuspendSameJobCompletionOnly import kotlinx.coroutines.GlobalScope @@ -35,3 +35,6 @@ suspend fun endMethod(k: Int) { // RUN_TO_CURSOR: 1 delay(1) } + +// REGISTRY: debugger.filter.breakpoints.by.coroutine.id=true +// REGISTRY: debugger.filter.breakpoints.by.coroutine.id.with.evaluation=false diff --git a/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameLambda.kt b/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameLambda.kt index 8edcbfd776c9..fdf4520623ae 100644 --- a/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameLambda.kt +++ b/plugins/kotlin/jvm-debugger/test/testData/evaluation/singleBreakpoint/frame/runToCursorSuspendSameLambda.kt @@ -1,5 +1,5 @@ // ATTACH_LIBRARY: maven(org.jetbrains.kotlinx:kotlinx-coroutines-debug:1.6.4)-javaagent -// REGISTRY: debugger.filter.breakpoints.by.coroutine.id=true + package runToCursorSuspendSameLambda import kotlinx.coroutines.GlobalScope @@ -34,3 +34,6 @@ fun main() { fun startMethod(i: Int) { } fun endMethod(k: Int) { } + +// REGISTRY: debugger.filter.breakpoints.by.coroutine.id=true +// REGISTRY: debugger.filter.breakpoints.by.coroutine.id.with.evaluation=false