Search in sources :

Example 1 with ObjectCollectedException

use of com.sun.jdi.ObjectCollectedException 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 ObjectCollectedException

use of com.sun.jdi.ObjectCollectedException 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)

Example 3 with ObjectCollectedException

use of com.sun.jdi.ObjectCollectedException in project intellij-community by JetBrains.

the class ThreadGroupDescriptorImpl method calcRepresentation.

protected String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener labelListener) throws EvaluateException {
    DebuggerManagerThreadImpl.assertIsManagerThread();
    ThreadGroupReferenceProxyImpl group = getThreadGroupReference();
    try {
        myName = group.name();
        return DebuggerBundle.message("label.thread.group.node", myName, group.uniqueID());
    } catch (ObjectCollectedException e) {
        return myName != null ? DebuggerBundle.message("label.thread.group.node.group.collected", myName) : "";
    }
}
Also used : ObjectCollectedException(com.sun.jdi.ObjectCollectedException) ThreadGroupReferenceProxyImpl(com.intellij.debugger.jdi.ThreadGroupReferenceProxyImpl)

Example 4 with ObjectCollectedException

use of com.sun.jdi.ObjectCollectedException in project intellij-community by JetBrains.

the class ThreadDescriptorImpl method calcRepresentation.

protected String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener labelListener) throws EvaluateException {
    DebuggerManagerThreadImpl.assertIsManagerThread();
    ThreadReferenceProxyImpl thread = getThreadReference();
    try {
        myName = thread.name();
        ThreadGroupReferenceProxyImpl gr = getThreadReference().threadGroupProxy();
        final String grname = (gr != null) ? gr.name() : null;
        final String threadStatusText = DebuggerUtilsEx.getThreadStatusText(getThreadReference().status());
        //noinspection HardCodedStringLiteral
        if (grname != null && !"SYSTEM".equalsIgnoreCase(grname)) {
            return DebuggerBundle.message("label.thread.node.in.group", myName, thread.uniqueID(), threadStatusText, grname);
        }
        return DebuggerBundle.message("label.thread.node", myName, thread.uniqueID(), threadStatusText);
    } catch (ObjectCollectedException e) {
        return myName != null ? DebuggerBundle.message("label.thread.node.thread.collected", myName) : "";
    }
}
Also used : ObjectCollectedException(com.sun.jdi.ObjectCollectedException) ThreadReferenceProxyImpl(com.intellij.debugger.jdi.ThreadReferenceProxyImpl) ThreadGroupReferenceProxyImpl(com.intellij.debugger.jdi.ThreadGroupReferenceProxyImpl)

Example 5 with ObjectCollectedException

use of com.sun.jdi.ObjectCollectedException in project intellij-community by JetBrains.

the class CodeFragmentFactoryContextWrapper method createMarkupVariablesText.

private static Pair<String, Map<String, ObjectReference>> createMarkupVariablesText(Map<?, ValueMarkup> markupMap) {
    final Map<String, ObjectReference> reverseMap = new HashMap<>();
    final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
    try {
        for (Map.Entry<?, ValueMarkup> entry : markupMap.entrySet()) {
            ObjectReference objectRef = (ObjectReference) entry.getKey();
            final ValueMarkup markup = entry.getValue();
            String labelName = markup.getText();
            if (!StringUtil.isJavaIdentifier(labelName)) {
                continue;
            }
            try {
                final String typeName = objectRef.type().name();
                labelName += DEBUG_LABEL_SUFFIX;
                if (buffer.length() > 0) {
                    buffer.append("\n");
                }
                buffer.append(typeName).append(" ").append(labelName).append(";");
                reverseMap.put(labelName, objectRef);
            } catch (ObjectCollectedException e) {
            //it.remove();
            }
        }
        buffer.append(" ");
        return Pair.create(buffer.toString(), reverseMap);
    } finally {
        StringBuilderSpinAllocator.dispose(buffer);
    }
}
Also used : ObjectCollectedException(com.sun.jdi.ObjectCollectedException) HashMap(java.util.HashMap) ObjectReference(com.sun.jdi.ObjectReference) HashMap(java.util.HashMap) Map(java.util.Map) ValueMarkup(com.intellij.xdebugger.impl.ui.tree.ValueMarkup)

Aggregations

ObjectCollectedException (com.sun.jdi.ObjectCollectedException)7 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)2 SuspendManager (com.intellij.debugger.engine.SuspendManager)2 ThreadGroupReferenceProxyImpl (com.intellij.debugger.jdi.ThreadGroupReferenceProxyImpl)2 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)2 ClassFilter (com.intellij.ui.classFilter.ClassFilter)1 ValueMarkup (com.intellij.xdebugger.impl.ui.tree.ValueMarkup)1 AbsentInformationException (com.sun.jdi.AbsentInformationException)1 ObjectReference (com.sun.jdi.ObjectReference)1 ReferenceType (com.sun.jdi.ReferenceType)1 ThreadReference (com.sun.jdi.ThreadReference)1 StepRequest (com.sun.jdi.request.StepRequest)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1