aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r--src/libexpr/eval.hh19
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;