diff options
-rw-r--r-- | src/libcmd/repl.cc | 16 | ||||
-rw-r--r-- | src/libexpr/primops.cc | 15 |
2 files changed, 8 insertions, 23 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 51bbbbc57..db88aa9b6 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -931,24 +931,10 @@ void runRepl( { auto repl = std::make_unique<NixRepl>(evalState); - // repl->debugError = debugError; + repl->debugError = debugError; repl->initEnv(); - // auto dts = debugError ? - // std::unique_ptr<DebugTraceStacker>( - // // tack on a final DebugTrace for the error position. - // new DebugTraceStacker( - // *evalState, - // DebugTrace - // {.pos = debugError->info().errPos, - // .expr = expr, - // .env = *repl->env, - // .hint = debugError->info().msg - // }) - // ) - // : nullptr; - // add 'extra' vars. std::set<std::string> names; for (auto & [name, value] : extraEnv) { diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 956c55e49..25845bdc4 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -699,6 +699,7 @@ static RegisterPrimOp primop_genericClosure(RegisterPrimOp::Info { .fun = prim_genericClosure, }); + static RegisterPrimOp primop_break({ .name = "break", .args = {"v"}, @@ -707,17 +708,15 @@ static RegisterPrimOp primop_break({ )", .fun = [](EvalState & state, const Pos & pos, Value * * args, Value & v) { - std::cout << "primop_break, value: " << *args[0] << std::endl; - // PathSet context; - // string s = state.coerceToString(pos, *args[0], context); + auto error = Error(ErrorInfo{ + .level = lvlInfo, + .msg = hintfmt("breakpoint reached; value was %1%", *args[0]), + .errPos = pos, + }); if (debuggerHook && !state.debugTraces.empty()) { auto &dt = state.debugTraces.front(); - // std::optional<ErrPos> pos; - // const Expr &expr; - // const Env &env; - // hintformat hint; - debuggerHook(nullptr, dt.env, dt.expr); + debuggerHook(&error, dt.env, dt.expr); // returning the value we were passed. v = *args[0]; |