From 3ddf864e1b2c5c27b2e6f7203e262c85bf760f7c Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 4 Feb 2022 14:50:25 -0700 Subject: [PATCH] print value in break --- src/libcmd/command.cc | 3 ++- src/libexpr/primops.cc | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 5848a15bf..701976265 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -77,7 +77,8 @@ ref EvalCommand::getEvalState() searchPath, getEvalStore(), getStore()); if (startReplOnEvalErrors) debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { - std::cout << "\033[2J\033[1;1H"; + // clear the screen. + // std::cout << "\033[2J\033[1;1H"; if (error) printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error->what()); diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 3a54e1490..48a10cd27 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -712,12 +712,13 @@ static RegisterPrimOp primop_genericClosure(RegisterPrimOp::Info { static RegisterPrimOp primop_break({ .name = "break", - .args = {}, + .args = {"v"}, .doc = R"( In debug mode, pause Nix expression evaluation and enter the repl. )", .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); if (debuggerHook && !state.debugTraces.empty()) @@ -728,6 +729,9 @@ static RegisterPrimOp primop_break({ // const Env &env; // hintformat hint; debuggerHook(nullptr, dt.env, dt.expr); + + // returning the value we were passed. + v = *args[0]; } } });