From 06940793025553be3eafa69dde956e4845b4dfca Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Tue, 8 Sep 2015 20:57:37 +0300 Subject: [PATCH] IDEA-63378 - never switch context automatically --- .../debugger/impl/DebuggerSession.java | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 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 fec95e704364..34f3ab2436a0 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java @@ -111,10 +111,6 @@ public class DebuggerSession implements AbstractDebuggerSession { mySteppingThroughThread.set(threadProxy); } - void unsetSteppingThrough(ThreadReferenceProxyImpl threadProxy) { - mySteppingThroughThread.compareAndSet(threadProxy, null); - } - void clearSteppingThrough() { mySteppingThroughThread.set(null); } @@ -346,12 +342,7 @@ public class DebuggerSession implements AbstractDebuggerSession { public void resume() { final SuspendContextImpl suspendContext = getSuspendContext(); if(suspendContext != null) { - if (suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_ALL) { - clearSteppingThrough(); - } - else { - unsetSteppingThrough(suspendContext.getThread()); - } + clearSteppingThrough(); resetIgnoreStepFiltersFlag(); resumeAction(myDebugProcess.createResumeCommand(suspendContext), Event.RESUME); } @@ -519,7 +510,7 @@ public class DebuggerSession implements AbstractDebuggerSession { return; } - clearSteppingThrough(); + setSteppingThrough(suspendContext.getThread()); ThreadReferenceProxyImpl currentThread = suspendContext.getThread(); final StackFrameContext positionContext; @@ -647,7 +638,7 @@ public class DebuggerSession implements AbstractDebuggerSession { } final SuspendContextImpl currentSuspendContext = getContextManager().getContext().getSuspendContext(); if (currentSuspendContext == null) { - return true; + return mySteppingThroughThread.get() == null; } if (enableBreakpointsDuringEvaluation()) { final ThreadReferenceProxyImpl currentThread = currentSuspendContext.getThread(); @@ -658,10 +649,13 @@ public class DebuggerSession implements AbstractDebuggerSession { @Override - public void resumed(final SuspendContextImpl suspendContext) { + public void resumed(SuspendContextImpl suspendContext) { SuspendManager suspendManager = getProcess().getSuspendManager(); SuspendContextImpl context = suspendManager.getPausedContext(); - if (context != null && suspendContext != null && isSteppingThrough(suspendContext.getThread())) { + // single thread stepping + if (suspendContext != null + && suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD + && isSteppingThrough(suspendContext.getThread())) { context = suspendManager.pushSuspendContext(suspendContext.getSuspendPolicy(), 0); context.setThread(suspendContext.getThread().getThreadReference()); }