Search in sources :

Example 11 with DebuggerCommandImpl

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

the class ThreadBlockedMonitor method onThreadBlocked.

private static void onThreadBlocked(@NotNull final ThreadReference blockedThread, @NotNull final ThreadReference blockingThread, final DebugProcessImpl process) {
    XDebugSessionImpl.NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("status.thread.blocked.by", blockedThread.name(), blockingThread.name()), DebuggerBundle.message("status.thread.blocked.by.resume", blockingThread.name()), NotificationType.INFORMATION, (notification, event) -> {
        if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
            notification.expire();
            process.getManagerThread().schedule(new DebuggerCommandImpl() {

                @Override
                protected void action() throws Exception {
                    ThreadReferenceProxyImpl threadProxy = process.getVirtualMachineProxy().getThreadReferenceProxy(blockingThread);
                    SuspendContextImpl suspendingContext = SuspendManagerUtil.getSuspendingContext(process.getSuspendManager(), threadProxy);
                    process.getManagerThread().invoke(process.createResumeThreadCommand(suspendingContext, threadProxy));
                }
            });
        }
    }).notify(process.getProject());
}
Also used : ScheduledFuture(java.util.concurrent.ScheduledFuture) HyperlinkEvent(javax.swing.event.HyperlinkEvent) ThreadReferenceProxyImpl(com.intellij.debugger.jdi.ThreadReferenceProxyImpl) Collection(java.util.Collection) ThreadReference(com.sun.jdi.ThreadReference) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) Disposable(com.intellij.openapi.Disposable) NotificationType(com.intellij.notification.NotificationType) HashSet(java.util.HashSet) TimeUnit(java.util.concurrent.TimeUnit) IncompatibleThreadStateException(com.sun.jdi.IncompatibleThreadStateException) Nullable(org.jetbrains.annotations.Nullable) ThreadReferenceProxy(com.intellij.debugger.engine.jdi.ThreadReferenceProxy) Disposer(com.intellij.openapi.util.Disposer) VirtualMachineProxyImpl(com.intellij.debugger.jdi.VirtualMachineProxyImpl) Registry(com.intellij.openapi.util.registry.Registry) DebuggerBundle(com.intellij.debugger.DebuggerBundle) ObjectReference(com.sun.jdi.ObjectReference) Logger(com.intellij.openapi.diagnostic.Logger) NotNull(org.jetbrains.annotations.NotNull) JobScheduler(com.intellij.concurrency.JobScheduler) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) ThreadReferenceProxyImpl(com.intellij.debugger.jdi.ThreadReferenceProxyImpl)

Example 12 with DebuggerCommandImpl

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

the class AddSteppingFilterAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
    DebugProcessImpl process = debuggerContext.getDebugProcess();
    if (process == null) {
        return;
    }
    final StackFrameProxyImpl proxy = PopFrameAction.getStackFrameProxy(e);
    process.getManagerThread().schedule(new DebuggerCommandImpl() {

        protected void action() throws Exception {
            final String name = getClassName(proxy != null ? proxy : debuggerContext.getFrameProxy());
            if (name == null) {
                return;
            }
            final Project project = e.getData(CommonDataKeys.PROJECT);
            ApplicationManager.getApplication().invokeLater(() -> {
                String filter = Messages.showInputDialog(project, "", "Add Stepping Filter", null, name, null);
                if (filter != null) {
                    ClassFilter[] newFilters = ArrayUtil.append(DebuggerSettings.getInstance().getSteppingFilters(), new ClassFilter(filter));
                    DebuggerSettings.getInstance().setSteppingFilters(newFilters);
                }
            });
        }
    });
}
Also used : StackFrameProxyImpl(com.intellij.debugger.jdi.StackFrameProxyImpl) Project(com.intellij.openapi.project.Project) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) ClassFilter(com.intellij.ui.classFilter.ClassFilter) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException)

Example 13 with DebuggerCommandImpl

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

the class DebuggerManagerThreadImpl method invokeCommand.

@Override
public void invokeCommand(final DebuggerCommand command) {
    if (command instanceof SuspendContextCommand) {
        SuspendContextCommand suspendContextCommand = (SuspendContextCommand) command;
        schedule(new SuspendContextCommandImpl((SuspendContextImpl) suspendContextCommand.getSuspendContext()) {

            @Override
            public void contextAction() throws Exception {
                command.action();
            }

            @Override
            protected void commandCancelled() {
                command.commandCancelled();
            }
        });
    } else {
        schedule(new DebuggerCommandImpl() {

            @Override
            protected void action() throws Exception {
                command.action();
            }

            @Override
            protected void commandCancelled() {
                command.commandCancelled();
            }
        });
    }
}
Also used : SuspendContextCommand(com.intellij.debugger.engine.managerThread.SuspendContextCommand) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) SuspendContextCommandImpl(com.intellij.debugger.engine.events.SuspendContextCommandImpl) VMDisconnectedException(com.sun.jdi.VMDisconnectedException)

Example 14 with DebuggerCommandImpl

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

the class DebuggerManagerThreadImpl method startLongProcessAndFork.

void startLongProcessAndFork(Runnable process) {
    assertIsManagerThread();
    startNewWorkerThread();
    try {
        process.run();
    } finally {
        final WorkerThreadRequest request = getCurrentThreadRequest();
        if (LOG.isDebugEnabled()) {
            LOG.debug("Switching back to " + request);
        }
        super.invokeAndWait(new DebuggerCommandImpl() {

            @Override
            protected void action() throws Exception {
                switchToRequest(request);
            }

            @Override
            protected void commandCancelled() {
                LOG.debug("Event queue was closed, killing request");
                request.requestStop();
            }
        });
    }
}
Also used : DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) VMDisconnectedException(com.sun.jdi.VMDisconnectedException)

Example 15 with DebuggerCommandImpl

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

the class JavaBreakpointHandler method registerBreakpoint.

@Override
public void registerBreakpoint(@NotNull XBreakpoint breakpoint) {
    Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
    if (javaBreakpoint == null) {
        javaBreakpoint = createJavaBreakpoint(breakpoint);
        breakpoint.putUserData(Breakpoint.DATA_KEY, javaBreakpoint);
    }
    if (javaBreakpoint != null) {
        final Breakpoint bpt = javaBreakpoint;
        BreakpointManager.addBreakpoint(bpt);
        // use schedule not to block initBreakpoints
        myProcess.getManagerThread().schedule(new DebuggerCommandImpl() {

            @Override
            protected void action() throws Exception {
                bpt.createRequest(myProcess);
            }

            @Override
            public Priority getPriority() {
                return Priority.HIGH;
            }
        });
    }
}
Also used : XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl)

Aggregations

DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)24 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)9 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)8 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)5 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)4 Project (com.intellij.openapi.project.Project)4 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)3 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)3 DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)3 ThreadDescriptorImpl (com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl)3 ExecutionException (com.intellij.execution.ExecutionException)3 VMDisconnectedException (com.sun.jdi.VMDisconnectedException)3 List (java.util.List)3 SuspendContextCommandImpl (com.intellij.debugger.engine.events.SuspendContextCommandImpl)2 VirtualMachineProxyImpl (com.intellij.debugger.jdi.VirtualMachineProxyImpl)2 InvalidDataException (com.intellij.openapi.util.InvalidDataException)2 XDebugSession (com.intellij.xdebugger.XDebugSession)2 ArrayList (java.util.ArrayList)2 Client (com.android.ddmlib.Client)1 InstantRunClient (com.android.tools.fd.client.InstantRunClient)1