From b4e940ebe4092fab381b836f3f5b76da2323b8d8 Mon Sep 17 00:00:00 2001 From: "Alexey.Merkulov" Date: Wed, 22 Oct 2025 14:44:42 +0200 Subject: [PATCH] [debugger] Preserve thread information for coroutine-thead stepping IDEA-381878 IDEA-365578 GitOrigin-RevId: 08052ccea1cd7382efce710372a10e82c12ceab0 --- .../intellij/debugger/impl/DebuggerSession.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java index adf320988fd4..bb25a1da8548 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java @@ -95,13 +95,9 @@ public final class DebuggerSession implements AbstractDebuggerSession { private boolean myModifiedClassesScanRequired = false; - public boolean isSteppingThrough(ThreadReferenceProxyImpl threadProxy) { - return Comparing.equal(mySteppingThroughThread.get(), threadProxy); - } - public void setSteppingThrough(ThreadReferenceProxyImpl threadProxy) { LightOrRealThreadInfo filterThread = myDebugProcess.getRequestsManager().getFilterThread(); - if (filterThread != null && filterThread.getRealThread() != null) { + if (filterThread == null || filterThread.getRealThread() != null) { mySteppingThroughThread.set(threadProxy); } else { @@ -732,7 +728,7 @@ public final class DebuggerSession implements AbstractDebuggerSession { @Override public void resumed(SuspendContextImpl suspendContext) { SuspendContextImpl context = getProcess().getSuspendManager().getPausedContext(); - ThreadReferenceProxyImpl steppingThread = getSteppingThread(suspendContext); + ThreadReferenceProxyImpl steppingThread = suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ? suspendContext.getThread() : null; DebuggerInvocationUtil.invokeLater(getProject(), () -> { if (myDebugProcess.isSteppingInProgress() && context != null) { @@ -818,13 +814,6 @@ public final class DebuggerSession implements AbstractDebuggerSession { getContextManager().setState(debuggerContext, State.IN_STEPPING, Event.CONTEXT, getDescription(debuggerContext)); } - public @Nullable ThreadReferenceProxyImpl getSteppingThread(@NotNull SuspendContextImpl suspendContext) { - if (suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD && isSteppingThrough(suspendContext.getThread())) { - return suspendContext.getThread(); - } - return null; - } - private static class BreakpointReachedNotificationListener extends NotificationListener.Adapter { private final WeakReference myContextRef;