Search in sources :

Example 1 with SuspendManager

use of com.intellij.debugger.engine.SuspendManager in project intellij-community by JetBrains.

the class DebuggerContextCommandImpl method contextAction.

@Override
public final void contextAction(@NotNull SuspendContextImpl suspendContext) throws Exception {
    SuspendManager suspendManager = myDebuggerContext.getDebugProcess().getSuspendManager();
    boolean isSuspendedByContext;
    try {
        isSuspendedByContext = suspendManager.isSuspended(getThread());
    } catch (ObjectCollectedException ignored) {
        notifyCancelled();
        return;
    }
    if (isSuspendedByContext) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Context thread " + suspendContext.getThread());
            LOG.debug("Debug thread" + getThread());
        }
        threadAction(suspendContext);
    } else {
        // no suspend context currently available
        SuspendContextImpl suspendContextForThread = myCustomThread != null ? suspendContext : SuspendManagerUtil.findContextByThread(suspendManager, getThread());
        if (suspendContextForThread != null) {
            suspendContextForThread.postponeCommand(this);
        } else {
            notifyCancelled();
        }
    }
}
Also used : ObjectCollectedException(com.sun.jdi.ObjectCollectedException) SuspendContextImpl(com.intellij.debugger.engine.SuspendContextImpl) SuspendManager(com.intellij.debugger.engine.SuspendManager)

Example 2 with SuspendManager

use of com.intellij.debugger.engine.SuspendManager in project intellij-community by JetBrains.

the class ThreadDescriptorImpl method setContext.

public void setContext(EvaluationContextImpl context) {
    final ThreadReferenceProxyImpl thread = getThreadReference();
    final SuspendManager suspendManager = context != null ? context.getDebugProcess().getSuspendManager() : null;
    final SuspendContextImpl suspendContext = context != null ? context.getSuspendContext() : null;
    try {
        myIsSuspended = suspendManager != null ? suspendManager.isSuspended(thread) : thread.isSuspended();
    } catch (ObjectCollectedException e) {
        myIsSuspended = false;
    }
    myIsExpandable = calcExpandable(myIsSuspended);
    mySuspendContext = suspendManager != null ? SuspendManagerUtil.findContextByThread(suspendManager, thread) : suspendContext;
    myIsAtBreakpoint = thread.isAtBreakpoint();
    myIsCurrent = suspendContext != null ? suspendContext.getThread() == thread : false;
    myIsFrozen = suspendManager != null ? suspendManager.isFrozen(thread) : myIsSuspended;
}
Also used : ObjectCollectedException(com.sun.jdi.ObjectCollectedException) SuspendContextImpl(com.intellij.debugger.engine.SuspendContextImpl) ThreadReferenceProxyImpl(com.intellij.debugger.jdi.ThreadReferenceProxyImpl) SuspendManager(com.intellij.debugger.engine.SuspendManager)

Aggregations

SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)2 SuspendManager (com.intellij.debugger.engine.SuspendManager)2 ObjectCollectedException (com.sun.jdi.ObjectCollectedException)2 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)1