private static void suspendWhenNoEvaluation(@NotNull SuspendContextImpl suspendContext,
                                              @NotNull Function<@NotNull SuspendContextImpl, Boolean> performOnSuspendAll) {
    DebugProcessImpl process = suspendContext.getDebugProcess();
    if (!switchContextWithSuspend(process, suspendContext, performOnSuspendAll)) {
      process.addEvaluationListener(new EvaluationListener() {
        @Override
        public void evaluationFinished(SuspendContextImpl context) {
          if (!process.myPreparingToSuspendAll) {
            process.removeEvaluationListener(this);
            return;
          }
          if (switchContextWithSuspend(process, suspendContext, performOnSuspendAll)) {
            process.removeEvaluationListener(this);
          }
          else {
            suspendContext.getVirtualMachine().resume();
          }
        }
      });
      suspendContext.getVirtualMachine().resume();
    }
  }
private static void suspendWhenNoEvaluation(@NotNull SuspendContextImpl suspendContext,
                                              @NotNull Function<@NotNull SuspendContextImpl, Boolean> performOnSuspendAll)