Search in sources :

Example 6 with XDebugProcess

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

the class KarmaDebugProgramRunner method createDescriptor.

@NotNull
private static RunContentDescriptor createDescriptor(@NotNull ExecutionEnvironment environment, @NotNull ExecutionResult executionResult, @NotNull KarmaConsoleView consoleView, @NotNull KarmaServer karmaServer, @NotNull DebuggableWebBrowser debuggableWebBrowser) throws ExecutionException {
    Url url = Urls.newFromEncoded(karmaServer.formatUrl("/"));
    DebuggableFileFinder fileFinder = getDebuggableFileFinder(karmaServer);
    XDebugSession session = XDebuggerManager.getInstance(environment.getProject()).startSession(environment, new XDebugProcessStarter() {

        @Override
        @NotNull
        public XDebugProcess start(@NotNull XDebugSession session) {
            JavaScriptDebugEngine debugEngine = debuggableWebBrowser.getDebugEngine();
            WebBrowser browser = debuggableWebBrowser.getWebBrowser();
            JavaScriptDebugProcess<? extends VmConnection> debugProcess = debugEngine.createDebugProcess(session, browser, fileFinder, url, executionResult, true);
            debugProcess.addFirstLineBreakpointPattern("\\.browserify$");
            debugProcess.setElementsInspectorEnabled(false);
            debugProcess.setConsoleMessagesSupportEnabled(false);
            debugProcess.setLayouter(consoleView.createDebugLayouter(debugProcess));
            Alarm alarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, consoleView);
            alarm.addRequest(() -> {
                resumeTestRunning(executionResult.getProcessHandler());
                Disposer.dispose(alarm);
            }, 2000);
            return debugProcess;
        }
    });
    return session.getRunContentDescriptor();
}
Also used : JavaScriptDebugProcess(com.intellij.javascript.debugger.JavaScriptDebugProcess) XDebugSession(com.intellij.xdebugger.XDebugSession) VmConnection(org.jetbrains.debugger.connection.VmConnection) XDebugProcess(com.intellij.xdebugger.XDebugProcess) WebBrowser(com.intellij.ide.browsers.WebBrowser) XDebugProcessStarter(com.intellij.xdebugger.XDebugProcessStarter) Alarm(com.intellij.util.Alarm) NotNull(org.jetbrains.annotations.NotNull) Url(com.intellij.util.Url) DebuggableFileFinder(com.intellij.javascript.debugger.DebuggableFileFinder) JavaScriptDebugEngine(com.intellij.javascript.debugger.JavaScriptDebugEngine) NotNull(org.jetbrains.annotations.NotNull)

Example 7 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 8 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 9 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)

Aggregations

XDebugProcess (com.intellij.xdebugger.XDebugProcess)9 XDebugSession (com.intellij.xdebugger.XDebugSession)8 XDebugProcessStarter (com.intellij.xdebugger.XDebugProcessStarter)7 NotNull (org.jetbrains.annotations.NotNull)7 ExecutionException (com.intellij.execution.ExecutionException)3 ServerSocket (java.net.ServerSocket)3 DebugEnvironment (com.intellij.debugger.DebugEnvironment)2 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)2 ExecutionResult (com.intellij.execution.ExecutionResult)2 IOException (java.io.IOException)2 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 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)1 RemoteConnection (com.intellij.execution.configurations.RemoteConnection)1 RunProfile (com.intellij.execution.configurations.RunProfile)1 RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)1 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)1