use of com.jetbrains.python.debugger.PyLocalPositionConverter in project intellij-community by JetBrains.
the class PyAttachToProcessDebugRunner method launchRemoteDebugServer.
private XDebugSession launchRemoteDebugServer() throws ExecutionException {
final ServerSocket serverSocket;
try {
//noinspection SocketOpenedButNotSafelyClosed
serverSocket = new ServerSocket(0);
} catch (IOException e) {
throw new ExecutionException("Failed to find free socket port", e);
}
PyAttachToProcessCommandLineState state = PyAttachToProcessCommandLineState.create(myProject, mySdkPath, serverSocket.getLocalPort(), myPid);
final ExecutionResult result = state.execute(state.getEnvironment().getExecutor(), this);
//start remote debug server
return XDebuggerManager.getInstance(myProject).startSessionAndShowTab(String.valueOf(myPid), null, new XDebugProcessStarter() {
@org.jetbrains.annotations.NotNull
public XDebugProcess start(@NotNull final XDebugSession session) {
PyRemoteDebugProcess pyDebugProcess = new PyRemoteDebugProcess(session, serverSocket, result.getExecutionConsole(), result.getProcessHandler(), "") {
@Override
protected void printConsoleInfo() {
}
@Override
protected String getConnectionMessage() {
return "Attaching to a process with PID=" + myPid;
}
@Override
protected String getConnectionTitle() {
return "Attaching Debugger";
}
};
pyDebugProcess.setPositionConverter(new PyLocalPositionConverter());
createConsoleCommunicationAndSetupActions(myProject, result, pyDebugProcess, session);
return pyDebugProcess;
}
});
}
Aggregations