void (@NotNull RemoteConfiguration runConfiguration, @NotNull Consumer<? super DebugProcess> callback) { DebuggerManager debuggerManager = DebuggerManager.getInstance(myProject); DebugProcess debugProcess = debuggerManager.getDebugProcess(myMainProcessHandler); if (debugProcess instanceof DebugProcessImpl) { RemoteConnection connection = runConfiguration.createRemoteConnection(); DebugEnvironment environment = new DefaultDebugEnvironment(myMainExecutionEnvironment, myMainRunnableState, connection, true); ApplicationManager.getApplication().invokeAndWait(() -> { ((DebugProcessImpl)debugProcess).reattach(environment, true, () -> callback.accept(debugProcess)); }); } }