use of com.goide.dlv.DlvDebugProcess in project nocalhost-intellij-plugin by nocalhost.
the class NocalhostGoDlvDebugRunner method attachDlv.
private RunContentDescriptor attachDlv(RunProfileState state, @NotNull ExecutionEnvironment env, String debugPort) throws ExecutionException {
NocalhostGoConfigurationFactory factory = (NocalhostGoConfigurationFactory) (new NocalhostGoConfigurationType().getConfigurationFactories())[0];
NocalhostGoConfiguration configuration = (NocalhostGoConfiguration) factory.createTemplateConfiguration(env.getProject());
Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();
ExecutionEnvironment environment = ExecutionEnvironmentBuilder.create(env.getProject(), executor, configuration).build();
NocalhostRunner runner = Objects.requireNonNull(ProgramRunner.PROGRAM_RUNNER_EP.findExtension(NocalhostRunner.class));
InetSocketAddress socketAddress = new InetSocketAddress("localhost", Integer.parseInt(debugPort));
ExecutionResult executionResult = state.execute(environment.getExecutor(), runner);
return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() {
@Override
@NotNull
public XDebugProcess start(@NotNull XDebugSession session) throws ExecutionException {
DlvDebugProcess process = new DlvDebugProcess(session, new NocalhostGoDlvRemoteVmConnection(DlvDisconnectOption.DETACH), executionResult, true);
process.connect(socketAddress);
return process;
}
}).getRunContentDescriptor();
}
use of com.goide.dlv.DlvDebugProcess in project intellij by bazelbuild.
the class BlazeGoDebugRunner method doExecute.
protected RunContentDescriptor doExecute(ExecutionEnvironment environment, BlazeGoDummyDebugProfileState blazeState) throws ExecutionException {
EventLoggingService.getInstance().logEvent(getClass(), "debugging-go");
GoApplicationRunningState goState = blazeState.toNativeState(environment);
ExecutionResult executionResult = goState.execute(environment.getExecutor(), this);
return XDebuggerManager.getInstance(environment.getProject()).startSession(environment, new XDebugProcessStarter() {
@Override
public XDebugProcess start(XDebugSession session) {
RemoteVmConnection<?> connection = new DlvRemoteVmConnection(DlvDisconnectOption.KILL);
XDebugProcess process = new DlvDebugProcess(session, connection, executionResult, /* remote= */
true);
connection.open(goState.getDebugAddress());
return process;
}
}).getRunContentDescriptor();
}
Aggregations