private void attachRemoteDebugger(
    @NotNull String debuggerId,
    @NotNull String processName,
    @NotNull String processParameters,
    @NotNull Socket accept,
    @NotNull DataInputStream inputStream
  ) {
    DebuggerBackendExtension extension = DebuggerBackendExtension.EP_NAME.findFirstSafe(it -> it.id().equals(debuggerId));
    if (extension != null) {
      RunnerAndConfigurationSettings settings = extension.debugConfigurationSettings(myProject, processName, processParameters);
      RunConfiguration runConfiguration = settings.getConfiguration();
      if (myMainRunnableState.isReattachDebugProcess()) {
        if (runConfiguration instanceof RemoteConfiguration) {
          reattachRemoteDebugger((RemoteConfiguration)runConfiguration, debugProcess -> {
            stopForkedProcessWhenMainProcessTerminated(debugProcess.getProcessHandler());
            initTerminateForkedProcessHandler(debugProcess.getProcessHandler());
            unblockRemote(accept, inputStream);
          });
          return;
        }
        ExternalSystemTaskDebugRunner.LOG.warn("Unsupported reattach child debugger process into main process");
      }
      runDebugConfiguration(settings, descriptor -> {
        // select tab for the forked process only when it has been suspended
        descriptor.setSelectContentWhenAdded(false);

        // restore selection of the 'main' tab to avoid flickering of the reused content tab when no suspend events occur
        stopForkedProcessWhenMainProcessTerminated(descriptor.getProcessHandler());
        removeRunContentWhenProcessIsTerminated(descriptor);
        initForkedProcessLogger(descriptor, processName);
        initTerminateForkedProcessHandler(descriptor.getProcessHandler());
        unblockRemote(accept, inputStream);
      });
    }
  }
private void attachRemoteDebugger(
    @NotNull String debuggerId,
    @NotNull String processName,
    @NotNull String processParameters,
    @NotNull Socket accept,
    @NotNull DataInputStream inputStream
  )