From 277042a171479c08ae6d2d7620c47885eda786dc Mon Sep 17 00:00:00 2001 From: "Alexey.Merkulov" Date: Mon, 20 Oct 2025 19:41:33 +0200 Subject: [PATCH] [debugger] Improve detecting when coroutine stepping is ended IDEA-381878 IDEA-365578 GitOrigin-RevId: 7e33cd4ecaba91088ed537b895b14f018c59e2c8 --- .../debugger/engine/SteppingProgressTracker.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/SteppingProgressTracker.kt b/java/debugger/impl/src/com/intellij/debugger/engine/SteppingProgressTracker.kt index 1516e7bc6839..e6c0ac74f7be 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/SteppingProgressTracker.kt +++ b/java/debugger/impl/src/com/intellij/debugger/engine/SteppingProgressTracker.kt @@ -12,7 +12,7 @@ import kotlinx.coroutines.CompletableDeferred import org.jetbrains.annotations.Nls import java.util.concurrent.CompletableFuture -private data class TrackedSteppingData(val stepCompetedStatus: CompletableDeferred, val threadFilter: (ThreadReferenceProxy?) -> Boolean) +private data class TrackedSteppingData(val stepCompetedStatus: CompletableDeferred, val threadFilter: (ThreadReferenceProxy?, SuspendContextImpl) -> Boolean) internal class SteppingProgressTracker(private val debuggerProcessImpl: DebugProcessImpl) { private val trackedStepping = mutableListOf() @@ -21,7 +21,7 @@ internal class SteppingProgressTracker(private val debuggerProcessImpl: DebugPro debuggerProcessImpl.addDebugProcessListener(object : DebugProcessListener { override fun paused(suspendContext: SuspendContext) { val thread = suspendContext.thread - val completedSteps = trackedStepping.filter { it.threadFilter(thread) } + val completedSteps = trackedStepping.filter { it.threadFilter(thread, suspendContext as SuspendContextImpl) } for ((stepCompetedStatus, _) in completedSteps) { stepCompetedStatus.complete(Unit) } @@ -30,7 +30,7 @@ internal class SteppingProgressTracker(private val debuggerProcessImpl: DebugPro }) } - fun addStepping(stepCompetedStatus: CompletableDeferred, threadFilter: (ThreadReferenceProxy?) -> Boolean) { + fun addStepping(stepCompetedStatus: CompletableDeferred, threadFilter: (ThreadReferenceProxy?, SuspendContextImpl) -> Boolean) { trackedStepping.add(TrackedSteppingData(stepCompetedStatus, threadFilter)) } } @@ -75,8 +75,8 @@ private class CancelingSteppingListener : SteppingListener { } val tracker = suspendContext.debugProcess.mySteppingProgressTracker - tracker.addStepping(stepCompetedStatus) { thread -> - !needSuspendOnlyThread || thread == null || thread == threadForStepping + tracker.addStepping(stepCompetedStatus) { thread, suspendContext -> + thread == null || filter != null && filter.checkSameThread(thread.threadReference, suspendContext) || thread == threadForStepping } } }