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;
}
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;
}
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);
}
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);
}
});
}
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);
}
});
}
Aggregations