diff options
author | Ben Burdette <bburdette@protonmail.com> | 2022-05-19 17:01:23 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@protonmail.com> | 2022-05-19 17:01:23 -0600 |
commit | 0600df86b8bc59633457f7ceb79e84c8ea3fed17 (patch) | |
tree | a369026f39acc3b3a63bb0fc67c18934f7c9974a /src/libexpr/eval.hh | |
parent | 7ddef73d026d79adc0c4f3fd1518d88d1331c38c (diff) |
'debugMode'
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r-- | src/libexpr/eval.hh | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 763150dae..711a4d6be 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -25,9 +25,6 @@ enum RepairFlag : bool; typedef void (* PrimOpFun) (EvalState & state, const PosIdx pos, Value * * args, Value & v); -void printEnvBindings(const EvalState &es, const Expr & expr, const Env & env); -void printEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env & env, int lvl = 0); - struct PrimOp { PrimOpFun fun; @@ -51,6 +48,11 @@ struct Env Value * values[0]; }; +extern void runRepl(ref<EvalState> evalState, const ValMap & extraEnv); + +void printEnvBindings(const EvalState &es, const Expr & expr, const Env & env); +void printEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env & env, int lvl = 0); + std::unique_ptr<ValMap> mapStaticEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env & env); void copyContext(const Value & v, PathSet & context); @@ -127,6 +129,7 @@ public: RootValue vImportedDrvToDerivation = nullptr; /* Debugger */ + bool debugMode; bool debugStop; bool debugQuit; std::list<DebugTrace> debugTraces; @@ -140,13 +143,14 @@ public: return std::shared_ptr<const StaticEnv>();; } + void debugRepl(const Error * error, const Env & env, const Expr & expr); template<class E> [[gnu::noinline, gnu::noreturn]] void debugThrow(const E &error, const Env & env, const Expr & expr) { - if (debuggerHook) - debuggerHook(*this, &error, env, expr); + if (debugMode) + debugRepl(&error, env, expr); throw error; } @@ -158,14 +162,15 @@ public: // 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()) { + if (debugMode && !debugTraces.empty()) { const DebugTrace & last = debugTraces.front(); - debuggerHook(*this, &e, last.env, last.expr); + debugRepl(&e, last.env, last.expr); } throw e; } + private: SrcToStore srcToStore; |