mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Enter debugger on builtins.trace
with an option
This commit is contained in:
parent
1ba9780cf5
commit
8b7eb7400b
2 changed files with 7 additions and 0 deletions
|
@ -127,6 +127,9 @@ struct EvalSettings : Config
|
||||||
|
|
||||||
Setting<unsigned int> maxCallDepth{this, 10000, "max-call-depth",
|
Setting<unsigned int> maxCallDepth{this, 10000, "max-call-depth",
|
||||||
"The maximum function call depth to allow before erroring."};
|
"The maximum function call depth to allow before erroring."};
|
||||||
|
|
||||||
|
Setting<bool> builtinsTraceDebugger{this, false, "builtins-trace-debugger",
|
||||||
|
"Whether to enter the debugger on `builtins.trace` calls."};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EvalSettings evalSettings;
|
extern EvalSettings evalSettings;
|
||||||
|
|
|
@ -995,6 +995,10 @@ static void prim_trace(EvalState & state, const PosIdx pos, Value * * args, Valu
|
||||||
printError("trace: %1%", args[0]->string_view());
|
printError("trace: %1%", args[0]->string_view());
|
||||||
else
|
else
|
||||||
printError("trace: %1%", ValuePrinter(state, *args[0]));
|
printError("trace: %1%", ValuePrinter(state, *args[0]));
|
||||||
|
if (evalSettings.builtinsTraceDebugger && state.debugRepl && !state.debugTraces.empty()) {
|
||||||
|
const DebugTrace & last = state.debugTraces.front();
|
||||||
|
state.runDebugRepl(nullptr, last.env, last.expr);
|
||||||
|
}
|
||||||
state.forceValue(*args[1], pos);
|
state.forceValue(*args[1], pos);
|
||||||
v = *args[1];
|
v = *args[1];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue