diff --git a/source/com/intellij/debugger/engine/DebugProcessImpl.java b/source/com/intellij/debugger/engine/DebugProcessImpl.java index 32f2d465b45a..cc0f73c71b9c 100644 --- a/source/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/source/com/intellij/debugger/engine/DebugProcessImpl.java @@ -106,7 +106,7 @@ public abstract class DebugProcessImpl implements DebugProcess { private final DescriptorHistoryManager myDescriptorHistoryManager; private final NodeRendererManagerImpl myNodeRendererManager = new NodeRendererManagerImpl(this); - private final SuspendManager mySuspendManager = new SuspendManagerImpl(this); + private final SuspendManagerImpl mySuspendManager = new SuspendManagerImpl(this); protected CompoundPositionManager myPositionManager = null; DebuggerManagerThreadImpl myDebuggerManagerThread; public static final String MSG_FAILD_TO_CONNECT = "Failed to establish connection to the target VM"; @@ -1243,9 +1243,8 @@ public abstract class DebugProcessImpl implements DebugProcess { logThreads(); getVirtualMachineProxy().suspend(); logThreads(); - SuspendContextImpl suspendContext = getSuspendManager().pushSuspendContext(EventRequest.SUSPEND_ALL, 0); - - myDebugProcessDispatcher.getMulticaster().paused(suspendContext); + SuspendContextImpl suspendContext = mySuspendManager.pushSuspendContext(EventRequest.SUSPEND_ALL, 0); + mySuspendManager.notifyPaused(suspendContext); } } diff --git a/source/com/intellij/debugger/engine/SuspendManagerImpl.java b/source/com/intellij/debugger/engine/SuspendManagerImpl.java index 5a171aad2912..60560212f562 100644 --- a/source/com/intellij/debugger/engine/SuspendManagerImpl.java +++ b/source/com/intellij/debugger/engine/SuspendManagerImpl.java @@ -265,7 +265,7 @@ public class SuspendManagerImpl implements SuspendManager { } } - private void notifyPaused(SuspendContextImpl suspendContext) { + public void notifyPaused(SuspendContextImpl suspendContext) { pushPausedContext(suspendContext); myDebugProcess.myDebugProcessDispatcher.getMulticaster().paused(suspendContext); } diff --git a/source/com/intellij/debugger/engine/events/DebuggerContextCommandImpl.java b/source/com/intellij/debugger/engine/events/DebuggerContextCommandImpl.java index c90059523da4..949f34d17e3f 100644 --- a/source/com/intellij/debugger/engine/events/DebuggerContextCommandImpl.java +++ b/source/com/intellij/debugger/engine/events/DebuggerContextCommandImpl.java @@ -31,15 +31,10 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm public final void contextAction() throws Exception { final SuspendManager suspendManager = myDebuggerContext.getDebugProcess().getSuspendManager(); - final boolean isSuspended = suspendManager.isSuspended(myDebuggerContext.getThreadProxy()); - if(isSuspended) { - if (LOG.isDebugEnabled()) { - LOG.debug("Context thread " + getSuspendContext().getThread()); - LOG.debug("Debug thread" + myDebuggerContext.getThreadProxy()); - } - threadAction(); - } - else { + Set suspendingContexts = SuspendManagerUtil.getSuspendingContexts(suspendManager, myDebuggerContext.getThreadProxy()); + + if(suspendingContexts.isEmpty()) { + // there are no suspend context currently registered SuspendContextImpl threadContext = SuspendManagerUtil.findContextByThread(suspendManager, myDebuggerContext.getThreadProxy()); if(threadContext != null) { SuspendManagerUtil.postponeCommand(threadContext, this); @@ -48,6 +43,13 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm notifyCancelled(); } } + else { + if (LOG.isDebugEnabled()) { + LOG.debug("Context thread " + getSuspendContext().getThread()); + LOG.debug("Debug thread" + myDebuggerContext.getThreadProxy()); + } + threadAction(); + } } abstract public void threadAction (); diff --git a/source/com/intellij/debugger/impl/EventQueue.java b/source/com/intellij/debugger/impl/EventQueue.java index 2efa6f0ec5b3..43a4f33ee342 100644 --- a/source/com/intellij/debugger/impl/EventQueue.java +++ b/source/com/intellij/debugger/impl/EventQueue.java @@ -40,6 +40,7 @@ public class EventQueue { } public void close(){ + System.out.println("EVENTS CLOSED!!!"); if (LOG.isDebugEnabled()) { LOG.debug("events closed"); } diff --git a/source/com/intellij/debugger/ui/impl/watch/DebuggerTree.java b/source/com/intellij/debugger/ui/impl/watch/DebuggerTree.java index 83c3e441e746..affe5d1303cc 100644 --- a/source/com/intellij/debugger/ui/impl/watch/DebuggerTree.java +++ b/source/com/intellij/debugger/ui/impl/watch/DebuggerTree.java @@ -528,7 +528,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi try { StackFrameDescriptorImpl stackDescriptor = (StackFrameDescriptorImpl)getNode().getDescriptor(); StackFrameProxyImpl frame = stackDescriptor.getStackFrame(); - //if(!getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(frame.threadProxy())) return; + if(!getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(frame.threadProxy())) return; LOG.assertTrue(frame.threadProxy().isSuspended()); @@ -571,7 +571,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi public void threadAction() { ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl)getNode().getDescriptor()); ThreadReferenceProxyImpl threadProxy = threadDescriptor.getThreadReference(); - if (!threadProxy.isCollected() /*&& getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(threadProxy)*/) { + if (!threadProxy.isCollected() && getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(threadProxy)) { int status = threadProxy.status(); if (!(status == ThreadReference.THREAD_STATUS_UNKNOWN) && !(status == ThreadReference.THREAD_STATUS_NOT_STARTED) &&