1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 22:01:15 +02:00

quit repl from step mode

This commit is contained in:
Ben Burdette 2022-02-15 09:49:25 -07:00
parent e761bf0601
commit c9bc3735f6
4 changed files with 26 additions and 7 deletions

View file

@ -438,6 +438,7 @@ EvalState::EvalState(
, store(store)
, buildStore(buildStore ? buildStore : store)
, debugStop(false)
, debugQuit(false)
, regexCache(makeRegexCache())
#if HAVE_BOEHMGC
, valueAllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr))

View file

@ -116,6 +116,7 @@ public:
RootValue vImportedDrvToDerivation = nullptr;
bool debugStop;
bool debugQuit;
std::list<DebugTrace> debugTraces;
void debug_throw(Error e);

View file

@ -718,6 +718,15 @@ static RegisterPrimOp primop_break({
auto &dt = state.debugTraces.front();
debuggerHook(&error, dt.env, dt.expr);
if (state.debugQuit) {
// if the user elects to quit the repl, throw an exception.
throw Error(ErrorInfo{
.level = lvlInfo,
.msg = hintfmt("quit from debugger"),
.errPos = pos,
});
}
// returning the value we were passed.
v = *args[0];
}