Search in sources :

Example 11 with XDebugProcess

use of com.intellij.xdebugger.XDebugProcess in project buck by facebook.

the class TestExecutionState method attachDebugger.

private void attachDebugger(String title, String port) {
    final RemoteConnection remoteConnection = new RemoteConnection(/* useSockets */
    true, "localhost", port, /* serverMode */
    false);
    final RemoteStateState state = new RemoteStateState(mProject, remoteConnection);
    final String name = title + " debugger (" + port + ")";
    final ConfigurationFactory cfgFactory = ConfigurationTypeUtil.findConfigurationType("Remote").getConfigurationFactories()[0];
    RunnerAndConfigurationSettings runSettings = RunManager.getInstance(mProject).createRunConfiguration(name, cfgFactory);
    final Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
    final ExecutionEnvironment env = new ExecutionEnvironmentBuilder(mProject, debugExecutor).runProfile(runSettings.getConfiguration()).build();
    final int pollTimeout = 3000;
    final DebugEnvironment environment = new DefaultDebugEnvironment(env, state, remoteConnection, pollTimeout);
    ApplicationManager.getApplication().invokeLater(() -> {
        try {
            final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(mProject).attachVirtualMachine(environment);
            if (debuggerSession == null) {
                return;
            }
            XDebuggerManager.getInstance(mProject).startSessionAndShowTab(name, null, new XDebugProcessStarter() {

                @Override
                @NotNull
                public XDebugProcess start(@NotNull XDebugSession session) {
                    return JavaDebugProcess.create(session, debuggerSession);
                }
            });
        } catch (ExecutionException e) {
            LOG.error("failed to attach to debugger on port " + port + " with polling timeout " + pollTimeout);
        }
    });
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) XDebugProcess(com.intellij.xdebugger.XDebugProcess) NotNull(org.jetbrains.annotations.NotNull) DefaultDebugEnvironment(com.intellij.debugger.DefaultDebugEnvironment) DefaultDebugExecutor(com.intellij.execution.executors.DefaultDebugExecutor) Executor(com.intellij.execution.Executor) DebuggerSession(com.intellij.debugger.impl.DebuggerSession) XDebugProcessStarter(com.intellij.xdebugger.XDebugProcessStarter) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) RemoteConnection(com.intellij.execution.configurations.RemoteConnection) RemoteStateState(com.intellij.debugger.engine.RemoteStateState) ExecutionEnvironmentBuilder(com.intellij.execution.runners.ExecutionEnvironmentBuilder) ExecutionException(com.intellij.execution.ExecutionException) DefaultDebugEnvironment(com.intellij.debugger.DefaultDebugEnvironment) DebugEnvironment(com.intellij.debugger.DebugEnvironment)

Example 12 with XDebugProcess

use of com.intellij.xdebugger.XDebugProcess in project intellij-community by JetBrains.

the class XVariablesView method addEmptyMessage.

protected void addEmptyMessage(XValueContainerNode root) {
    XDebugSession session = getSession(getPanel());
    if (session != null) {
        if (!session.isStopped() && session.isPaused()) {
            root.setInfoMessage("Frame is not available", null);
        } else {
            XDebugProcess debugProcess = session.getDebugProcess();
            root.setInfoMessage(debugProcess.getCurrentStateMessage(), debugProcess.getCurrentStateHyperlinkListener());
        }
    }
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) XDebugProcess(com.intellij.xdebugger.XDebugProcess)

Example 13 with XDebugProcess

use of com.intellij.xdebugger.XDebugProcess in project intellij-community by JetBrains.

the class DebuggerAction method refreshViews.

public static void refreshViews(@Nullable XDebugSession session) {
    if (session != null) {
        XDebugProcess process = session.getDebugProcess();
        if (process instanceof JavaDebugProcess) {
            ((JavaDebugProcess) process).saveNodeHistory();
        }
        session.rebuildViews();
    }
}
Also used : XDebugProcess(com.intellij.xdebugger.XDebugProcess) JavaDebugProcess(com.intellij.debugger.engine.JavaDebugProcess)

Example 14 with XDebugProcess

use of com.intellij.xdebugger.XDebugProcess in project flutter-intellij by flutter.

the class LaunchState method createDebugSession.

@NotNull
private XDebugSession createDebugSession(@NotNull final ExecutionEnvironment env, @NotNull final FlutterApp app, @NotNull final ExecutionResult executionResult) throws ExecutionException {
    final DartUrlResolver resolver = DartUrlResolver.getInstance(env.getProject(), sourceLocation);
    final PositionMapper mapper = createPositionMapper(env, app, resolver);
    final XDebuggerManager manager = XDebuggerManager.getInstance(env.getProject());
    final XDebugSession session = manager.startSession(env, new XDebugProcessStarter() {

        @Override
        @NotNull
        public XDebugProcess start(@NotNull final XDebugSession session) {
            return new FlutterDebugProcess(app, env, session, executionResult, resolver, mapper);
        }
    });
    if (app.getMode() != RunMode.DEBUG) {
        session.setBreakpointMuted(true);
    }
    return session;
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) XDebugProcess(com.intellij.xdebugger.XDebugProcess) XDebugProcessStarter(com.intellij.xdebugger.XDebugProcessStarter) DartUrlResolver(com.jetbrains.lang.dart.util.DartUrlResolver) XDebuggerManager(com.intellij.xdebugger.XDebuggerManager) NotNull(org.jetbrains.annotations.NotNull) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

XDebugProcess (com.intellij.xdebugger.XDebugProcess)14 XDebugSession (com.intellij.xdebugger.XDebugSession)13 XDebugProcessStarter (com.intellij.xdebugger.XDebugProcessStarter)12 NotNull (org.jetbrains.annotations.NotNull)12 ExecutionException (com.intellij.execution.ExecutionException)6 ExecutionResult (com.intellij.execution.ExecutionResult)3 XDebuggerManager (com.intellij.xdebugger.XDebuggerManager)3 DartUrlResolver (com.jetbrains.lang.dart.util.DartUrlResolver)3 ServerSocket (java.net.ServerSocket)3 DebugEnvironment (com.intellij.debugger.DebugEnvironment)2 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)2 IOException (java.io.IOException)2 Nullable (org.jetbrains.annotations.Nullable)2 CloudAttachDialog (com.google.cloud.tools.intellij.debugger.ui.CloudAttachDialog)1 DefaultDebugEnvironment (com.intellij.debugger.DefaultDebugEnvironment)1 JavaDebugProcess (com.intellij.debugger.engine.JavaDebugProcess)1 RemoteStateState (com.intellij.debugger.engine.RemoteStateState)1 Executor (com.intellij.execution.Executor)1 RunCanceledByUserException (com.intellij.execution.RunCanceledByUserException)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1