@Nullable
  private static LocalAttachInfo getProcessAttachInfoInt(String pid, boolean validate) {
    VirtualMachine vm = null;
    try {
      vm = validate ? JavaDebuggerAttachUtil.attachVirtualMachine(pid) : VirtualMachine.attach(pid);
      Properties agentProperties = vm.getAgentProperties();
      String command = agentProperties.getProperty("sun.java.command");
      if (!StringUtil.isEmpty(command)) {
        command = StringUtil.replace(command, AppMainV2.class.getName(), "").trim();
        command = StringUtil.notNullize(StringUtil.substringBefore(command, " "), command);
      }
      String property = agentProperties.getProperty("sun.jdwp.listenerAddress");
      if (property != null && property.indexOf(':') != -1) {
        boolean autoAddress = false;
        String args = agentProperties.getProperty("sun.jvm.args");
        if (!StringUtil.isEmpty(args)) {
          for (String arg : args.split(" ")) {
            if (arg.startsWith("-agentlib:jdwp")) {
              autoAddress = !arg.contains("address=");
              break;
            }
          }
        }
        return new DebuggerLocalAttachInfo(!"dt_shmem".equals(StringUtil.substringBefore(property, ":")),
                                           StringUtil.substringAfter(property, ":"),
                                           command, pid, null, autoAddress);
      }

      //do not allow further for idea process
      // read only attach is disabled on macos because of IDEA-252760
      if (!pid.equals(OSProcessUtil.getApplicationPid()) && !SystemInfo.isMac) {
        Properties systemProperties = vm.getSystemProperties();

        // prefer sa-jdwp attach if available
        // sa pid attach if sa-jdi.jar is available
        LocalAttachInfo info = SAJDWPLocalAttachInfo.create(systemProperties, command, pid);
        if (info != null) {
          return info;
        }

        // sa pid attach if sa-jdi.jar is available
        info = SAPIDLocalAttachInfo.create(systemProperties, command, pid);
        if (info != null) {
          return info;
        }
      }
    }
    catch (InternalError e) {
      LOG.warn(e);
    }
    catch (AttachNotSupportedException | IOException ignored) {
    }
    finally {
      if (vm != null) {
        try {
          vm.detach();
        }
        catch (IOException ignored) {
        }
      }
    }
    return null;
  }
@Nullable
  private static LocalAttachInfo getProcessAttachInfoInt(String pid, boolean validate)