Search in sources :

Example 1 with StackFrameItem

use of com.intellij.debugger.memory.utils.StackFrameItem in project intellij-community by JetBrains.

the class StackCapturingLineBreakpoint method processLocatableEvent.

@Override
public boolean processLocatableEvent(SuspendContextCommandImpl action, LocatableEvent event) throws EventProcessingException {
    SuspendContextImpl suspendContext = action.getSuspendContext();
    if (suspendContext != null) {
        ThreadReferenceProxyImpl thread = suspendContext.getThread();
        if (thread != null) {
            DebugProcessImpl process = suspendContext.getDebugProcess();
            try {
                StackFrameProxyImpl frameProxy = ContainerUtil.getFirstItem(thread.forceFrames());
                if (frameProxy != null) {
                    Map<Object, List<StackFrameItem>> stacks = process.getUserData(CAPTURED_STACKS);
                    if (stacks == null) {
                        stacks = new CapturedStacksMap();
                        process.putUserData(CAPTURED_STACKS, Collections.synchronizedMap(stacks));
                    }
                    Value key = myCaptureEvaluator.evaluate(new EvaluationContextImpl(suspendContext, frameProxy));
                    if (key instanceof ObjectReference) {
                        List<StackFrameItem> frames = StackFrameItem.createFrames(suspendContext, true);
                        if (frames.size() > MAX_STACK_LENGTH) {
                            frames = frames.subList(0, MAX_STACK_LENGTH);
                        }
                        stacks.put(getKey((ObjectReference) key), frames);
                    }
                }
            } catch (EvaluateException e) {
                LOG.debug(e);
                process.printToConsole(DebuggerBundle.message("error.unable.to.evaluate.capture.expression", e.getMessage()) + "\n");
            }
        }
    }
    return false;
}
Also used : StackFrameProxyImpl(com.intellij.debugger.jdi.StackFrameProxyImpl) ThreadReferenceProxyImpl(com.intellij.debugger.jdi.ThreadReferenceProxyImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) SuspendContextImpl(com.intellij.debugger.engine.SuspendContextImpl) List(java.util.List) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) StackFrameItem(com.intellij.debugger.memory.utils.StackFrameItem)

Example 2 with StackFrameItem

use of com.intellij.debugger.memory.utils.StackFrameItem in project intellij-community by JetBrains.

the class JumpToAllocationSourceAction method perform.

@Override
protected void perform(XValueNodeImpl node, @NotNull String nodeName, AnActionEvent e) {
    final Project project = e.getProject();
    final List<StackFrameItem> stack = getStack(e);
    if (project != null && stack != null) {
        final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
        if (session != null) {
            DebugProcessImpl process = (DebugProcessImpl) DebuggerManager.getInstance(project).getDebugProcess(session.getDebugProcess().getProcessHandler());
            StackFramePopup.show(stack, process);
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) XDebugSession(com.intellij.xdebugger.XDebugSession) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) StackFrameItem(com.intellij.debugger.memory.utils.StackFrameItem)

Example 3 with StackFrameItem

use of com.intellij.debugger.memory.utils.StackFrameItem in project intellij-community by JetBrains.

the class ShowRelatedStackAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    Project project = e.getProject();
    List<StackFrameItem> stack = getRelatedStack(e);
    if (project != null && stack != null) {
        DebugProcessImpl debugProcess = DebuggerAction.getDebuggerContext(e.getDataContext()).getDebugProcess();
        if (debugProcess == null) {
            return;
        }
        StackFramePopup.show(stack, debugProcess);
    }
}
Also used : Project(com.intellij.openapi.project.Project) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) StackFrameItem(com.intellij.debugger.memory.utils.StackFrameItem)

Aggregations

DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)3 StackFrameItem (com.intellij.debugger.memory.utils.StackFrameItem)3 Project (com.intellij.openapi.project.Project)2 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)1 StackFrameProxyImpl (com.intellij.debugger.jdi.StackFrameProxyImpl)1 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)1 XDebugSession (com.intellij.xdebugger.XDebugSession)1 List (java.util.List)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1