void RDebugger::setCommand()

in src/debugger/RDebugger.cpp [139:156]


void RDebugger::setCommand(DebuggerCommand c) {
  currentCommand = c;
  if (c == CONTINUE || c == STEP_INTO || c == STEP_INTO_MY_CODE || c == ABORT || c == PAUSE) return;
  for (auto const& p : contextsToStop) R_ReleaseObject(p.first);
  contextsToStop.clear();
  bool skipFirst = c == STEP_OUT;
  for (RContext *ctx = getGlobalContext(); ctx != nullptr; ctx = getNextContext(ctx)) {
    if (isCallContext(ctx)) {
      if (skipFirst) {
        skipFirst = false;
      } else {
        SEXP callEnv = ctx == bottomContext ? bottomContextRealEnv : getEnvironment(ctx);
        contextsToStop.insert({callEnv, getEvalDepth(ctx)});
      }
    }
  }
  for (auto const& p : contextsToStop) R_PreserveObject(p.first);
}