diff options
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/eval.cc | 1 | ||||
-rw-r--r-- | src/libexpr/eval.hh | 1 | ||||
-rw-r--r-- | src/libexpr/primops.cc | 9 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 71a28bafa..3a835adb3 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -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)) diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 1390c8885..e1d117c36 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -116,6 +116,7 @@ public: RootValue vImportedDrvToDerivation = nullptr; bool debugStop; + bool debugQuit; std::list<DebugTrace> debugTraces; void debug_throw(Error e); diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 25845bdc4..80d78e150 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -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]; } |