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

for primops, enter the debugger at the last DebugTrace in the stack

This commit is contained in:
Ben Burdette 2022-02-11 14:14:25 -07:00
parent 3ff5ac3586
commit 4cffb130e3
4 changed files with 99 additions and 85 deletions

View file

@ -437,7 +437,7 @@ EvalState::EvalState(
, emptyBindings(0)
, store(store)
, buildStore(buildStore ? buildStore : store)
, debugStop(true)
, debugStop(false)
, regexCache(makeRegexCache())
#if HAVE_BOEHMGC
, valueAllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr))
@ -787,6 +787,17 @@ LocalNoInlineNoReturn(void throwEvalError(const char * s, const string & s2, Eva
throw error;
}
void EvalState::debug_throw(Error e) {
// call this in the situation where Expr and Env are inaccessible. The debugger will start in the last context
// that's in the DebugTrace stack.
if (debuggerHook && !debugTraces.empty()) {
DebugTrace &last = debugTraces.front();
debuggerHook(&e, last.env, last.expr);
}
throw e;
}
LocalNoInlineNoReturn(void throwEvalError(const Pos & pos, const char * s, Env & env, Expr *expr))
{
auto error = EvalError({