@Override
    protected void perform(AnActionEvent event, ProcessProxy proxy, ProcessHandler processHandler) {
      Project project = event.getProject();
      if (project == null) {
        return;
      }
      RunnerContentUi runnerContentUi = event.getData(RunnerContentUi.KEY);
      if (Registry.is("execution.dump.threads.using.attach") && processHandler instanceof BaseProcessHandler && runnerContentUi != null) {
        String pid = String.valueOf(((BaseProcessHandler<?>)processHandler).getProcess().pid());
        RunTab runTab = event.getData(RunTab.KEY);
        GlobalSearchScope scope =
          runTab instanceof RunContentBuilder ? ((RunContentBuilder)runTab).getSearchScope() : GlobalSearchScope.allScope(project);
        if (!JavaDebuggerAttachUtil.getAttachedPids(project).contains(pid)) {
          myExecutor.execute(() -> {
            VirtualMachine vm = null;
            try {
              vm = JavaDebuggerAttachUtil.attachVirtualMachine(pid);
              InputStream inputStream = (InputStream)vm.getClass()
                .getMethod("remoteDataDump", Object[].class)
                .invoke(vm, new Object[]{ArrayUtil.EMPTY_OBJECT_ARRAY});
              String text;
              try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) {
                text = StreamUtil.readText(reader);
              }
              List<ThreadState> threads = ThreadDumpParser.parse(text);
              ApplicationManager.getApplication().invokeLater(
                () -> DebuggerUtilsEx.addThreadDump(project, threads, runnerContentUi.getRunnerLayoutUi(), scope),
                ModalityState.nonModal());
            }
            catch (AttachNotSupportedException e) {
              LOG.debug(e);
              dumpWithBreak(proxy, project, processHandler);
            }
            catch (Exception e) {
              LOG.warn(e);
              dumpWithBreak(proxy, project, processHandler);
            }
            finally {
              if (vm != null) {
                try {
                  vm.detach();
                }
                catch (IOException ignored) {
                }
              }
            }
          });
          return;
        }
      }
      dumpWithBreak(proxy, project, processHandler);
    }
@Override
    protected void perform(AnActionEvent event, ProcessProxy proxy, ProcessHandler processHandler)