private static List<StackFrameItem> getProcessCapturedStack(EvaluationContextImpl evalContext)
    throws EvaluateException {
    EvaluationContextImpl evaluationContext = evalContext.withAutoLoadClasses(false);

    DebugProcessImpl process = evaluationContext.getDebugProcess();
    Pair<ClassType, Method> methodPair = process.getUserData(CAPTURE_STORAGE_METHOD);

    if (methodPair == null) {
      try {
        ClassType captureClass = (ClassType)process.findClass(evaluationContext, CAPTURE_STORAGE_CLASS_NAME, null);
        if (captureClass == null) {
          methodPair = NO_CAPTURE_AGENT;
          LOG.debug("Error loading debug agent", "agent class not found");
        }
        else {
          methodPair = Pair.create(captureClass, DebuggerUtils.findMethod(captureClass, "getCurrentCapturedStack", null));
        }
      }
      catch (EvaluateException e) {
        methodPair = NO_CAPTURE_AGENT;
        LOG.debug("Error loading debug agent", e);
      }
      putProcessUserData(CAPTURE_STORAGE_METHOD, methodPair, process);
    }

    if (methodPair == NO_CAPTURE_AGENT) {
      return null;
    }

    VirtualMachineProxyImpl virtualMachineProxy = evalContext.getSuspendContext().getVirtualMachine();
    List<Value> args = Collections.singletonList(virtualMachineProxy.mirrorOf(getMaxStackLength()));
    Pair<ClassType, Method> finalMethodPair = methodPair;
    String value = DebuggerUtils.processCollectibleValue(
      () -> process.invokeMethod(evaluationContext, finalMethodPair.first, finalMethodPair.second,
                                 args, ObjectReference.INVOKE_SINGLE_THREADED, true),
      result -> result instanceof StringReference ? ((StringReference)result).value() : null
    );
    if (value != null) {
      List<StackFrameItem> res = new ArrayList<>();
      ClassesByNameProvider classesByName = ClassesByNameProvider.createCache(virtualMachineProxy.allClasses());
      try (DataInputStream dis = new DataInputStream(new ByteArrayInputStream(value.getBytes(StandardCharsets.ISO_8859_1)))) {
        while (dis.available() > 0) {
          StackFrameItem item = null;
          if (dis.readBoolean()) {
            String className = dis.readUTF();
            String methodName = dis.readUTF();
            int line = dis.readInt();
            Location location = DebuggerUtilsEx.findOrCreateLocation(process, classesByName, className, methodName, line);
            item = new StackFrameItem(location, null);
          }
          res.add(item);
        }
        return res;
      }
      catch (Exception e) {
        DebuggerUtilsImpl.logError(e);
      }
    }
    return null;
  }
private static List<StackFrameItem> getProcessCapturedStack(EvaluationContextImpl evalContext)