Search in sources :

Example 1 with RemoteConnection

use of com.intellij.execution.configurations.RemoteConnection in project intellij-community by JetBrains.

the class DebuggerSession method getStateDescription.

public String getStateDescription() {
    if (myState.myDescription != null) {
        return myState.myDescription;
    }
    switch(myState.myState) {
        case STOPPED:
            return DebuggerBundle.message("status.debug.stopped");
        case RUNNING:
            return DebuggerBundle.message("status.app.running");
        case WAITING_ATTACH:
            RemoteConnection connection = getProcess().getConnection();
            final String addressDisplayName = DebuggerBundle.getAddressDisplayName(connection);
            final String transportName = DebuggerBundle.getTransportName(connection);
            return connection.isServerMode() ? DebuggerBundle.message("status.listening", addressDisplayName, transportName) : DebuggerBundle.message("status.connecting", addressDisplayName, transportName);
        case PAUSED:
            return DebuggerBundle.message("status.paused");
        case WAIT_EVALUATION:
            return DebuggerBundle.message("status.waiting.evaluation.result");
        case DISPOSED:
            return DebuggerBundle.message("status.debug.stopped");
    }
    return null;
}
Also used : RemoteConnection(com.intellij.execution.configurations.RemoteConnection)

Example 2 with RemoteConnection

use of com.intellij.execution.configurations.RemoteConnection in project intellij-community by JetBrains.

the class DebuggerSession method attach.

@Nullable
private ExecutionResult attach(DebugEnvironment environment) throws ExecutionException {
    RemoteConnection remoteConnection = environment.getRemoteConnection();
    final String addressDisplayName = DebuggerBundle.getAddressDisplayName(remoteConnection);
    final String transportName = DebuggerBundle.getTransportName(remoteConnection);
    final ExecutionResult executionResult = myDebugProcess.attachVirtualMachine(environment, this);
    getContextManager().setState(SESSION_EMPTY_CONTEXT, State.WAITING_ATTACH, Event.START_WAIT_ATTACH, DebuggerBundle.message("status.waiting.attach", addressDisplayName, transportName));
    return executionResult;
}
Also used : ExecutionResult(com.intellij.execution.ExecutionResult) RemoteConnection(com.intellij.execution.configurations.RemoteConnection) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with RemoteConnection

use of com.intellij.execution.configurations.RemoteConnection in project intellij-community by JetBrains.

the class RemoteConfigurable method updateHelpText.

private void updateHelpText() {
    boolean useSockets = !myRbShmem.isSelected();
    final RemoteConnection connection = new RemoteConnection(useSockets, myHostName, useSockets ? myPortField.getText().trim() : myAddressField.getText().trim(), myRbListen.isSelected());
    final String cmdLine = connection.getLaunchCommandLine();
    // -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7007
    final String jvmtiCmdLine = cmdLine.replace("-Xdebug", "").replace("-Xrunjdwp:", "-agentlib:jdwp=").trim();
    myHelpArea.updateText(jvmtiCmdLine);
    myJDK14HelpArea.updateText(cmdLine);
    myJDK13HelpArea.updateText("-Xnoagent -Djava.compiler=NONE " + cmdLine);
}
Also used : RemoteConnection(com.intellij.execution.configurations.RemoteConnection)

Example 4 with RemoteConnection

use of com.intellij.execution.configurations.RemoteConnection 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 5 with RemoteConnection

use of com.intellij.execution.configurations.RemoteConnection in project azure-tools-for-java by Microsoft.

the class SparkBatchJobDebuggerRunner method startDebuggerObservable.

/**
     * Start Spark batch job remote debugging
     *
     * @param environment ID of the {@link Executor} with which the user is trying to run the configuration.
     * @param callback callback when debugger is prepared
     * @param submissionState the submission state from run configuration
     * @param remoteDebugJob the remote Spark job which is listening a port for debugging
     * @return a single Observable with SparkBatchDebugSession instance which is done
     */
protected Single<SparkBatchDebugSession> startDebuggerObservable(@NotNull ExecutionEnvironment environment, @Nullable Callback callback, @NotNull SparkBatchJobSubmissionState submissionState, @NotNull SparkBatchRemoteDebugJob remoteDebugJob) {
    SparkSubmitModel submitModel = submissionState.getSubmitModel();
    IClusterDetail clusterDetail = submitModel.getSelectedClusterDetail();
    return Single.fromEmitter(em -> {
        try {
            SimpleEntry<SparkBatchDebugSession, Integer> sessionPortPair = createSshPortForwardDebugSession(clusterDetail.getConnectionUrl(), submitModel, remoteDebugJob);
            submissionState.setRemoteConnection(new RemoteConnection(true, "localhost", Integer.toString(sessionPortPair.getValue()), false));
            super.execute(environment, callback, submissionState);
            em.onSuccess(sessionPortPair.getKey());
        } catch (Exception ex) {
            em.onError(ex);
        }
    });
}
Also used : RemoteConnection(com.intellij.execution.configurations.RemoteConnection) IClusterDetail(com.microsoft.azure.hdinsight.sdk.cluster.IClusterDetail) ExecutionException(com.intellij.execution.ExecutionException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) CompositeException(rx.exceptions.CompositeException) JSchException(com.jcraft.jsch.JSchException)

Aggregations

RemoteConnection (com.intellij.execution.configurations.RemoteConnection)10 ExecutionException (com.intellij.execution.ExecutionException)6 DebugEnvironment (com.intellij.debugger.DebugEnvironment)3 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)3 DefaultDebugEnvironment (com.intellij.debugger.DefaultDebugEnvironment)2 DebugProcess (com.intellij.debugger.engine.DebugProcess)2 ProcessHandler (com.intellij.execution.process.ProcessHandler)2 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)2 ExecutionEnvironmentBuilder (com.intellij.execution.runners.ExecutionEnvironmentBuilder)2 IOException (java.io.IOException)2 Client (com.android.ddmlib.Client)1 IDevice (com.android.ddmlib.IDevice)1 NullOutputReceiver (com.android.ddmlib.NullOutputReceiver)1 DebugUIEnvironment (com.intellij.debugger.DebugUIEnvironment)1 TransportServiceWrapper (com.intellij.debugger.apiAdapters.TransportServiceWrapper)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 DebugProcessListener (com.intellij.debugger.engine.DebugProcessListener)1 RemoteDebugProcessHandler (com.intellij.debugger.engine.RemoteDebugProcessHandler)1 RemoteStateState (com.intellij.debugger.engine.RemoteStateState)1 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)1