Search in sources :

Example 1 with Breakpoint

use of com.intellij.debugger.ui.breakpoints.Breakpoint in project intellij-community by JetBrains.

the class BreakpointsContextProvider method clearContext.

public void clearContext() {
    final BreakpointManager breakpointManager = ((DebuggerManagerEx) myDebuggerManager).getBreakpointManager();
    List<Breakpoint> breakpoints = breakpointManager.getBreakpoints();
    for (final Breakpoint breakpoint : breakpoints) {
        ApplicationManager.getApplication().runWriteAction(() -> breakpointManager.removeBreakpoint(breakpoint));
    }
}
Also used : Breakpoint(com.intellij.debugger.ui.breakpoints.Breakpoint) DebuggerManagerEx(com.intellij.debugger.DebuggerManagerEx) BreakpointManager(com.intellij.debugger.ui.breakpoints.BreakpointManager)

Example 2 with Breakpoint

use of com.intellij.debugger.ui.breakpoints.Breakpoint in project intellij-community by JetBrains.

the class XBreakpointGroupingByClassRule method getGroup.

@Override
public XBreakpointClassGroup getGroup(@NotNull B b, @NotNull Collection<XBreakpointClassGroup> groups) {
    if (b instanceof XBreakpoint) {
        Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint((XBreakpoint) b);
        if (javaBreakpoint == null) {
            return null;
        }
        String className = javaBreakpoint.getShortClassName();
        String packageName = javaBreakpoint.getPackageName();
        if (className == null) {
            return null;
        }
        for (XBreakpointClassGroup group : groups) {
            if (group.getClassName().equals(className) && group.getPackageName().equals(packageName)) {
                return group;
            }
        }
        return new XBreakpointClassGroup(packageName, className);
    }
    return null;
}
Also used : Breakpoint(com.intellij.debugger.ui.breakpoints.Breakpoint) XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint) XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint)

Example 3 with Breakpoint

use of com.intellij.debugger.ui.breakpoints.Breakpoint in project intellij-community by JetBrains.

the class JavaStackFrame method buildVariablesThreadAction.

// copied from DebuggerTree
private void buildVariablesThreadAction(DebuggerContextImpl debuggerContext, XValueChildrenList children, XCompositeNode node) {
    try {
        final EvaluationContextImpl evaluationContext = debuggerContext.createEvaluationContext();
        if (evaluationContext == null) {
            return;
        }
        if (!debuggerContext.isEvaluationPossible()) {
            node.setErrorMessage(MessageDescriptor.EVALUATION_NOT_POSSIBLE.getLabel());
        //myChildren.add(myNodeManager.createNode(MessageDescriptor.EVALUATION_NOT_POSSIBLE, evaluationContext));
        }
        final Location location = myDescriptor.getLocation();
        final ObjectReference thisObjectReference = myDescriptor.getThisObject();
        if (thisObjectReference != null) {
            ValueDescriptorImpl thisDescriptor = myNodeManager.getThisDescriptor(null, thisObjectReference);
            children.add(JavaValue.create(thisDescriptor, evaluationContext, myNodeManager));
        } else if (location != null) {
            StaticDescriptorImpl staticDecriptor = myNodeManager.getStaticDescriptor(myDescriptor, location.declaringType());
            if (staticDecriptor.isExpandable()) {
                children.addTopGroup(new JavaStaticGroup(staticDecriptor, evaluationContext, myNodeManager));
            }
        }
        DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
        if (debugProcess == null) {
            return;
        }
        // add last method return value if any
        final Pair<Method, Value> methodValuePair = debugProcess.getLastExecutedMethod();
        if (methodValuePair != null && myDescriptor.getUiIndex() == 0) {
            ValueDescriptorImpl returnValueDescriptor = myNodeManager.getMethodReturnValueDescriptor(myDescriptor, methodValuePair.getFirst(), methodValuePair.getSecond());
            children.add(JavaValue.create(returnValueDescriptor, evaluationContext, myNodeManager));
        }
        // add context exceptions
        Set<ObjectReference> exceptions = new HashSet<>();
        for (Pair<Breakpoint, Event> pair : DebuggerUtilsEx.getEventDescriptors(debuggerContext.getSuspendContext())) {
            Event debugEvent = pair.getSecond();
            if (debugEvent instanceof ExceptionEvent) {
                ObjectReference exception = ((ExceptionEvent) debugEvent).exception();
                if (exception != null) {
                    exceptions.add(exception);
                }
            }
        }
        exceptions.forEach(e -> children.add(JavaValue.create(myNodeManager.getThrownExceptionObjectDescriptor(myDescriptor, e), evaluationContext, myNodeManager)));
        try {
            buildVariables(debuggerContext, evaluationContext, debugProcess, children, thisObjectReference, location);
        //if (classRenderer.SORT_ASCENDING) {
        //  Collections.sort(myChildren, NodeManagerImpl.getNodeComparator());
        //}
        } catch (EvaluateException e) {
            node.setErrorMessage(e.getMessage());
        //myChildren.add(myNodeManager.createMessageNode(new MessageDescriptor(e.getMessage())));
        }
    } catch (InvalidStackFrameException e) {
        LOG.info(e);
    //myChildren.clear();
    //notifyCancelled();
    } catch (InternalException e) {
        if (e.errorCode() == 35) {
            node.setErrorMessage(DebuggerBundle.message("error.corrupt.debug.info", e.getMessage()));
        //myChildren.add(
        //  myNodeManager.createMessageNode(new MessageDescriptor(DebuggerBundle.message("error.corrupt.debug.info", e.getMessage()))));
        } else {
            throw e;
        }
    }
}
Also used : ExceptionEvent(com.sun.jdi.event.ExceptionEvent) Breakpoint(com.intellij.debugger.ui.breakpoints.Breakpoint) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) EvaluationContextImpl(com.intellij.debugger.engine.evaluation.EvaluationContextImpl) Event(com.sun.jdi.event.Event) ExceptionEvent(com.sun.jdi.event.ExceptionEvent)

Example 4 with Breakpoint

use of com.intellij.debugger.ui.breakpoints.Breakpoint in project intellij-community by JetBrains.

the class DebuggerUtilsEx method getEventDescriptors.

@NotNull
public static List<Pair<Breakpoint, Event>> getEventDescriptors(@Nullable SuspendContextImpl suspendContext) {
    DebuggerManagerThreadImpl.assertIsManagerThread();
    if (suspendContext != null) {
        EventSet events = suspendContext.getEventSet();
        if (!ContainerUtil.isEmpty(events)) {
            List<Pair<Breakpoint, Event>> eventDescriptors = ContainerUtil.newSmartList();
            RequestManagerImpl requestManager = suspendContext.getDebugProcess().getRequestsManager();
            for (Event event : events) {
                Requestor requestor = requestManager.findRequestor(event.request());
                if (requestor instanceof Breakpoint) {
                    eventDescriptors.add(Pair.create((Breakpoint) requestor, event));
                }
            }
            return eventDescriptors;
        }
    }
    return Collections.emptyList();
}
Also used : Breakpoint(com.intellij.debugger.ui.breakpoints.Breakpoint) EventSet(com.sun.jdi.event.EventSet) Event(com.sun.jdi.event.Event) Requestor(com.intellij.debugger.requests.Requestor) RequestManagerImpl(com.intellij.debugger.engine.requests.RequestManagerImpl) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with Breakpoint

use of com.intellij.debugger.ui.breakpoints.Breakpoint in project intellij-community by JetBrains.

the class DebugProcessEvents method showStatusText.

private static void showStatusText(DebugProcessEvents debugProcess, Event event) {
    Requestor requestor = debugProcess.getRequestsManager().findRequestor(event.request());
    Breakpoint breakpoint = null;
    if (requestor instanceof Breakpoint) {
        breakpoint = (Breakpoint) requestor;
    }
    String text = debugProcess.getEventText(Pair.create(breakpoint, event));
    debugProcess.showStatusText(text);
}
Also used : StackCapturingLineBreakpoint(com.intellij.debugger.ui.breakpoints.StackCapturingLineBreakpoint) XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint) Breakpoint(com.intellij.debugger.ui.breakpoints.Breakpoint) LocatableEventRequestor(com.intellij.debugger.engine.requests.LocatableEventRequestor) Requestor(com.intellij.debugger.requests.Requestor)

Aggregations

Breakpoint (com.intellij.debugger.ui.breakpoints.Breakpoint)13 DebuggerManagerEx (com.intellij.debugger.DebuggerManagerEx)4 BreakpointManager (com.intellij.debugger.ui.breakpoints.BreakpointManager)4 XBreakpoint (com.intellij.xdebugger.breakpoints.XBreakpoint)4 StackCapturingLineBreakpoint (com.intellij.debugger.ui.breakpoints.StackCapturingLineBreakpoint)3 Project (com.intellij.openapi.project.Project)3 SourcePosition (com.intellij.debugger.SourcePosition)2 LocatableEventRequestor (com.intellij.debugger.engine.requests.LocatableEventRequestor)2 Requestor (com.intellij.debugger.requests.Requestor)2 FieldBreakpoint (com.intellij.debugger.ui.breakpoints.FieldBreakpoint)2 Document (com.intellij.openapi.editor.Document)2 XDebugSession (com.intellij.xdebugger.XDebugSession)2 XLineBreakpoint (com.intellij.xdebugger.breakpoints.XLineBreakpoint)2 XBreakpointBase (com.intellij.xdebugger.impl.breakpoints.XBreakpointBase)2 InternalException (com.sun.jdi.InternalException)2 Event (com.sun.jdi.event.Event)2 Client (com.android.ddmlib.Client)1 InstantRunClient (com.android.tools.fd.client.InstantRunClient)1 InstantRunPushFailedException (com.android.tools.fd.client.InstantRunPushFailedException)1 CloudLineBreakpointType (com.google.cloud.tools.intellij.debugger.CloudLineBreakpointType)1