From f32c687f03e9764e55831d894b719fdf0104cf25 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Wed, 28 Apr 2021 15:50:11 -0600 Subject: move repl.cc to libcmd for linkage --- src/libcmd/command.cc | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 644c9c3b0..d790bb51d 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -54,6 +54,7 @@ void StoreCommand::run() run(getStore()); } +/* EvalCommand::EvalCommand() { addFlag({ @@ -77,6 +78,42 @@ ref EvalCommand::getEvalState() } return ref(evalState); } +*/ +EvalCommand::EvalCommand() +{ + addFlag({ + .longName = "debugger", + .description = "start an interactive environment if evaluation fails", + .handler = {&startReplOnEvalErrors, true}, + }); +} +// ref EvalCommand::getEvalState() +// { +// if (!evalState) +// evalState = std::make_shared(searchPath, getStore()); +// return ref(evalState); +// } +extern std::function & env)> debuggerHook; + +ref EvalCommand::getEvalState() +{ + if (!evalState) { + evalState = std::make_shared(searchPath, getStore()); + if (startReplOnEvalErrors) + debuggerHook = [evalState{ref(evalState)}](const Error & error, const std::map & env) { + printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); + runRepl(evalState, env); + }; + } + return ref(evalState); +} + +EvalCommand::~EvalCommand() +{ + if (evalState) + evalState->printStats(); +} + RealisedPathsCommand::RealisedPathsCommand(bool recursive) : recursive(recursive) -- cgit v1.2.3 From 2dd61411af903e374566e0cf5d06257ad240662e Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 3 May 2021 14:37:33 -0600 Subject: debugger on autoCallFunction error --- src/libcmd/command.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index d790bb51d..51a071d25 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -79,24 +79,28 @@ ref EvalCommand::getEvalState() return ref(evalState); } */ +// ref EvalCommand::getEvalState() +// { +// if (!evalState) +// evalState = std::make_shared(searchPath, getStore()); +// return ref(evalState); +// } + + EvalCommand::EvalCommand() { + // std::cout << "EvalCommand::EvalCommand()" << std::endl; addFlag({ .longName = "debugger", .description = "start an interactive environment if evaluation fails", .handler = {&startReplOnEvalErrors, true}, }); } -// ref EvalCommand::getEvalState() -// { -// if (!evalState) -// evalState = std::make_shared(searchPath, getStore()); -// return ref(evalState); -// } extern std::function & env)> debuggerHook; ref EvalCommand::getEvalState() { + std::cout << " EvalCommand::getEvalState()" << startReplOnEvalErrors << std::endl; if (!evalState) { evalState = std::make_shared(searchPath, getStore()); if (startReplOnEvalErrors) -- cgit v1.2.3 From 030271184fecbbe9dd871b71d92c61e163254646 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 9 Aug 2021 14:30:47 -0600 Subject: trying env args; but unecessary? --- src/libcmd/command.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 51a071d25..86b6f37f8 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -96,7 +96,8 @@ EvalCommand::EvalCommand() .handler = {&startReplOnEvalErrors, true}, }); } -extern std::function & env)> debuggerHook; +// extern std::function & env)> debuggerHook; +extern std::function debuggerHook; ref EvalCommand::getEvalState() { -- cgit v1.2.3 From b6eb38016b9d16cf206f3f2b0cd4bce4dea40345 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Tue, 17 Aug 2021 14:39:50 -0600 Subject: moving towards env in exceptions --- src/libcmd/command.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 86b6f37f8..59ab1f874 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -105,7 +105,7 @@ ref EvalCommand::getEvalState() if (!evalState) { evalState = std::make_shared(searchPath, getStore()); if (startReplOnEvalErrors) - debuggerHook = [evalState{ref(evalState)}](const Error & error, const std::map & env) { + debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); runRepl(evalState, env); }; -- cgit v1.2.3 From 4b5f9b35f06754aaf578a2d4b3d730949964ef05 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Wed, 18 Aug 2021 21:25:26 -0600 Subject: env to bindings --- src/libcmd/command.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 59ab1f874..a32c4a24b 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -99,6 +99,8 @@ EvalCommand::EvalCommand() // extern std::function & env)> debuggerHook; extern std::function debuggerHook; + + ref EvalCommand::getEvalState() { std::cout << " EvalCommand::getEvalState()" << startReplOnEvalErrors << std::endl; @@ -107,7 +109,8 @@ ref EvalCommand::getEvalState() if (startReplOnEvalErrors) debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); - runRepl(evalState, env); + auto vm = mapEnvBindings(env); + runRepl(evalState, *vm); }; } return ref(evalState); -- cgit v1.2.3 From bd3b5329f91e6caff387cf361a5c779468f34f88 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Tue, 24 Aug 2021 16:32:54 -0600 Subject: print env bindings --- src/libcmd/command.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index a32c4a24b..1a59dff77 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -109,6 +109,7 @@ ref EvalCommand::getEvalState() if (startReplOnEvalErrors) debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); + printEnvBindings(env); auto vm = mapEnvBindings(env); runRepl(evalState, *vm); }; -- cgit v1.2.3 From d8a977a22ebd8884124a0a80e6b1523228f70f4b Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Wed, 25 Aug 2021 11:19:09 -0600 Subject: adding all the value names from env.values[0] --- src/libcmd/command.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 1a59dff77..45665b555 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -103,7 +103,7 @@ extern std::function debuggerHook; ref EvalCommand::getEvalState() { - std::cout << " EvalCommand::getEvalState()" << startReplOnEvalErrors << std::endl; + std::cout << "EvalCommand::getEvalState()" << startReplOnEvalErrors << std::endl; if (!evalState) { evalState = std::make_shared(searchPath, getStore()); if (startReplOnEvalErrors) -- cgit v1.2.3 From 176911102ce2c0be06bbfed9099f364d71c3c679 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 13 Sep 2021 11:57:25 -0600 Subject: printEnvPosChain --- src/libcmd/command.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 45665b555..07f4208da 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -109,6 +109,7 @@ ref EvalCommand::getEvalState() if (startReplOnEvalErrors) debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); + // printEnvPosChain(env); printEnvBindings(env); auto vm = mapEnvBindings(env); runRepl(evalState, *vm); -- cgit v1.2.3 From cd8c232b554776031f61cee5f70a8825c60fbfdb Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Wed, 15 Sep 2021 16:16:53 -0600 Subject: add cout debugging --- src/libcmd/command.cc | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 07f4208da..55f6ffd00 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -99,8 +99,6 @@ EvalCommand::EvalCommand() // extern std::function & env)> debuggerHook; extern std::function debuggerHook; - - ref EvalCommand::getEvalState() { std::cout << "EvalCommand::getEvalState()" << startReplOnEvalErrors << std::endl; -- cgit v1.2.3 From 2ee1fa4afd69226f16305e792d5110fd36669c6b Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 11 Oct 2021 14:42:29 -0600 Subject: add nullable Expr argument --- src/libcmd/command.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 55f6ffd00..705b30d53 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -97,7 +97,7 @@ EvalCommand::EvalCommand() }); } // extern std::function & env)> debuggerHook; -extern std::function debuggerHook; +extern std::function debuggerHook; ref EvalCommand::getEvalState() { @@ -105,7 +105,7 @@ ref EvalCommand::getEvalState() if (!evalState) { evalState = std::make_shared(searchPath, getStore()); if (startReplOnEvalErrors) - debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env) { + debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env, const Expr & expr) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); // printEnvPosChain(env); printEnvBindings(env); -- cgit v1.2.3 From 98eb13691a16d9472b822a92f32b439a6ee6e288 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 11 Oct 2021 16:32:43 -0600 Subject: print staticenv bindings --- src/libcmd/command.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 705b30d53..d8e79953c 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -107,10 +107,16 @@ ref EvalCommand::getEvalState() if (startReplOnEvalErrors) debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env, const Expr & expr) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); + + printStaticEnvBindings(expr); + // printEnvPosChain(env); - printEnvBindings(env); - auto vm = mapEnvBindings(env); - runRepl(evalState, *vm); + // printEnvBindings(env); + if (expr.staticenv) + { + auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); + runRepl(evalState, *vm); + } }; } return ref(evalState); -- cgit v1.2.3 From 383ab600ee1f36f14677a0082473f5680193c12c Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 22 Oct 2021 13:41:04 -0600 Subject: show expr on error --- src/libcmd/command.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index d8e79953c..2d86dbd61 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -110,6 +110,10 @@ ref EvalCommand::getEvalState() printStaticEnvBindings(expr); + std::cout << "expr: " << std::endl; + expr.show(std::cout); + std::cout << std::endl; + // printEnvPosChain(env); // printEnvBindings(env); if (expr.staticenv) -- cgit v1.2.3 From cbc2f0fe31576a6403e179bdbbaf9aefa113555b Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 22 Oct 2021 14:02:47 -0600 Subject: remove dead code --- src/libcmd/command.cc | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 2d86dbd61..8d5098bc7 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -54,7 +54,6 @@ void StoreCommand::run() run(getStore()); } -/* EvalCommand::EvalCommand() { addFlag({ @@ -64,39 +63,6 @@ EvalCommand::EvalCommand() }); } -extern std::function & env)> debuggerHook; - -ref EvalCommand::getEvalState() -{ - if (!evalState) { - evalState = std::make_shared(searchPath, getStore()); - if (startReplOnEvalErrors) - debuggerHook = [evalState{ref(evalState)}](const Error & error, const std::map & env) { - printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); - runRepl(evalState, env); - }; - } - return ref(evalState); -} -*/ -// ref EvalCommand::getEvalState() -// { -// if (!evalState) -// evalState = std::make_shared(searchPath, getStore()); -// return ref(evalState); -// } - - -EvalCommand::EvalCommand() -{ - // std::cout << "EvalCommand::EvalCommand()" << std::endl; - addFlag({ - .longName = "debugger", - .description = "start an interactive environment if evaluation fails", - .handler = {&startReplOnEvalErrors, true}, - }); -} -// extern std::function & env)> debuggerHook; extern std::function debuggerHook; ref EvalCommand::getEvalState() @@ -114,8 +80,6 @@ ref EvalCommand::getEvalState() expr.show(std::cout); std::cout << std::endl; - // printEnvPosChain(env); - // printEnvBindings(env); if (expr.staticenv) { auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); -- cgit v1.2.3 From e54f17eb46bc487abc38e70dfc2f1c617fb59d32 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 22 Oct 2021 14:27:04 -0600 Subject: remove more debug code --- src/libcmd/command.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 8d5098bc7..8a6dd71b2 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -67,7 +67,6 @@ extern std::function EvalCommand::getEvalState() { - std::cout << "EvalCommand::getEvalState()" << startReplOnEvalErrors << std::endl; if (!evalState) { evalState = std::make_shared(searchPath, getStore()); if (startReplOnEvalErrors) @@ -80,7 +79,7 @@ ref EvalCommand::getEvalState() expr.show(std::cout); std::cout << std::endl; - if (expr.staticenv) + if (expr.staticenv) { auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); runRepl(evalState, *vm); -- cgit v1.2.3 From 69e26c5c4ba106bd16f60bfaac88ccf888b4383f Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Thu, 25 Nov 2021 08:23:07 -0700 Subject: more cleanup --- src/libcmd/command.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 8a6dd71b2..2c62bfa7f 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -81,8 +81,8 @@ ref EvalCommand::getEvalState() if (expr.staticenv) { - auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); - runRepl(evalState, *vm); + auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); + runRepl(evalState, *vm); } }; } -- cgit v1.2.3 From e82aec4efcd06cbd60d57f401fb7e93ab595128c Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Tue, 30 Nov 2021 14:15:02 -0700 Subject: fix merge issues --- src/libcmd/command.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 4c5d985aa..2e00b42ff 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -68,7 +68,7 @@ extern std::function EvalCommand::getEvalState() { if (!evalState) { - evalState = std::make_shared(searchPath, getStore()); + evalState = std::make_shared(searchPath, getEvalStore(), getStore()); if (startReplOnEvalErrors) debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env, const Expr & expr) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); @@ -102,13 +102,6 @@ ref EvalCommand::getEvalStore() return ref(evalStore); } -ref EvalCommand::getEvalState() -{ - if (!evalState) - evalState = std::make_shared(searchPath, getEvalStore(), getStore()); - return ref(evalState); -} - BuiltPathsCommand::BuiltPathsCommand(bool recursive) : recursive(recursive) { -- cgit v1.2.3 From f317019edda7afac8590e68d4d979b03a2cdbf62 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 20 Dec 2021 12:32:21 -0700 Subject: :d error --- src/libcmd/command.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 2e00b42ff..b37959a2e 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -82,7 +82,7 @@ ref EvalCommand::getEvalState() if (expr.staticenv) { auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); - runRepl(evalState, *vm); + runRepl(evalState, ref(&error), *vm); } }; } -- cgit v1.2.3 From b4a59a5eec5bdb94ee2bbc8365f024d5787abd60 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Wed, 22 Dec 2021 15:38:49 -0700 Subject: DebugStackTracker class in one place --- src/libcmd/command.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index b37959a2e..0ada5fa3c 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -75,6 +75,8 @@ ref EvalCommand::getEvalState() printStaticEnvBindings(expr); + std::cout << evalState->vCallFlake << std::endl; + std::cout << "expr: " << std::endl; expr.show(std::cout); std::cout << std::endl; -- cgit v1.2.3 From e5eebda19475ab4f25346128e5428c27e526c7ce Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Thu, 23 Dec 2021 13:36:39 -0700 Subject: DebugTrace --- src/libcmd/command.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 0ada5fa3c..6c0f84c4b 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -84,7 +84,7 @@ ref EvalCommand::getEvalState() if (expr.staticenv) { auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); - runRepl(evalState, ref(&error), *vm); + runRepl(evalState, &error, *vm); } }; } -- cgit v1.2.3 From 9760fa8661f7562e0b8979338200904053cc4631 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 27 Dec 2021 17:35:27 -0700 Subject: add DebugTrace for the current error --- src/libcmd/command.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 6c0f84c4b..897d81981 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -84,7 +84,7 @@ ref EvalCommand::getEvalState() if (expr.staticenv) { auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); - runRepl(evalState, &error, *vm); + runRepl(evalState, &error, expr, *vm); } }; } -- cgit v1.2.3 From 4610e02d04c9f41ac355d2ca6a27d3a631ffefc6 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 27 Dec 2021 18:12:46 -0700 Subject: remove debug code --- src/libcmd/command.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 897d81981..b97458b2d 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -73,13 +73,13 @@ ref EvalCommand::getEvalState() debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env, const Expr & expr) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); - printStaticEnvBindings(expr); + // printStaticEnvBindings(expr); - std::cout << evalState->vCallFlake << std::endl; + // std::cout << evalState->vCallFlake << std::endl; - std::cout << "expr: " << std::endl; - expr.show(std::cout); - std::cout << std::endl; + // std::cout << "expr: " << std::endl; + // expr.show(std::cout); + // std::cout << std::endl; if (expr.staticenv) { -- cgit v1.2.3 From 5954cbf3e9dca0e3b84e4bf2def74abb3d6f80cd Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 27 Dec 2021 18:29:55 -0700 Subject: more cleanup --- src/libcmd/command.cc | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index b97458b2d..e44c737f5 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -73,14 +73,6 @@ ref EvalCommand::getEvalState() debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env, const Expr & expr) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); - // printStaticEnvBindings(expr); - - // std::cout << evalState->vCallFlake << std::endl; - - // std::cout << "expr: " << std::endl; - // expr.show(std::cout); - // std::cout << std::endl; - if (expr.staticenv) { auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); -- cgit v1.2.3 From c6691089814ac16eb02bab968a97ea2b0fe942f2 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 3 Jan 2022 18:13:16 -0700 Subject: merge cleanup --- src/libcmd/command.cc | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index b254a90f0..252bc1fad 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -68,7 +68,13 @@ extern std::function EvalCommand::getEvalState() { if (!evalState) { - evalState = std::make_shared(searchPath, getEvalStore(), getStore()); + evalState = +#if HAVE_BOEHMGC + std::allocate_shared(traceable_allocator(), +#else + std::make_shared( +#endif + searchPath, getEvalStore(), getStore()); if (startReplOnEvalErrors) debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env, const Expr & expr) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); @@ -96,18 +102,6 @@ ref EvalCommand::getEvalStore() return ref(evalStore); } -ref EvalCommand::getEvalState() -{ - if (!evalState) evalState = -#if HAVE_BOEHMGC - std::allocate_shared(traceable_allocator(), -#else - std::make_shared( -#endif - searchPath, getEvalStore(), getStore()); - return ref(evalState); -} - BuiltPathsCommand::BuiltPathsCommand(bool recursive) : recursive(recursive) { -- cgit v1.2.3 From a963674d88f2f1af6181f126ed4288ec65b61fc6 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Sat, 8 Jan 2022 11:03:48 -0700 Subject: optinoal error; compiles --- src/libcmd/command.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 252bc1fad..ed8f6d295 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -63,7 +63,7 @@ EvalCommand::EvalCommand() }); } -extern std::function debuggerHook; +extern std::function debuggerHook; ref EvalCommand::getEvalState() { @@ -76,13 +76,14 @@ ref EvalCommand::getEvalState() #endif searchPath, getEvalStore(), getStore()); if (startReplOnEvalErrors) - debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env, const Expr & expr) { - printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); + debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { + 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()); if (expr.staticenv) { auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); - runRepl(evalState, &error, expr, *vm); + runRepl(evalState, error, expr, *vm); } }; } -- cgit v1.2.3 From 990bec78d30c5e23cd6aa83a6f98b1d4199bd8c3 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Sat, 8 Jan 2022 15:43:04 -0700 Subject: clear screen and show top debug trace --- src/libcmd/command.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index ed8f6d295..5848a15bf 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -77,8 +77,30 @@ 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"; + 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()); + else + { + auto iter = evalState->debugTraces.begin(); + if (iter != evalState->debugTraces.end()) { + std::cout << "\n" << "… " << iter->hint.str() << "\n"; + + if (iter->pos.has_value() && (*iter->pos)) { + auto pos = iter->pos.value(); + std::cout << "\n"; + printAtPos(pos, std::cout); + + auto loc = getCodeLines(pos); + if (loc.has_value()) { + std::cout << "\n"; + printCodeLines(std::cout, "", pos, *loc); + std::cout << "\n"; + } + } + } + } if (expr.staticenv) { -- cgit v1.2.3 From 3ddf864e1b2c5c27b2e6f7203e262c85bf760f7c Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 4 Feb 2022 14:50:25 -0700 Subject: print value in break --- src/libcmd/command.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') 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()); -- cgit v1.2.3 From 3dfab6e534e0a1cf71c000a4d2a74e050ba576ce Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 14 Mar 2022 11:58:11 -0600 Subject: have only one debuggerHook declaration --- src/libcmd/command.cc | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 56288665a..18aa82577 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -93,10 +93,6 @@ EvalCommand::EvalCommand() }); } -extern std::function debuggerHook; - - - EvalCommand::~EvalCommand() { if (evalState) -- cgit v1.2.3 From 88a54108ebcdbeb1432d9afe5363557c25f94cfa Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Wed, 16 Mar 2022 12:09:47 -0600 Subject: formatting --- src/libcmd/command.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 18aa82577..209c455fc 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -128,7 +128,7 @@ ref EvalCommand::getEvalState() else { auto iter = evalState->debugTraces.begin(); - if (iter != evalState->debugTraces.end()) { + if (iter != evalState->debugTraces.end()) { std::cout << "\n" << "… " << iter->hint.str() << "\n"; if (iter->pos.has_value() && (*iter->pos)) { -- cgit v1.2.3 From 1bec3fb337b86f87e7600fc6b6072ded1a7d4927 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 25 Mar 2022 18:15:31 -0600 Subject: add DebugTrace for error --- src/libcmd/command.cc | 58 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 21 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 209c455fc..34535802f 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -122,29 +122,45 @@ ref EvalCommand::getEvalState() debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { // clear the screen. // std::cout << "\033[2J\033[1;1H"; - + + auto dts = + error && expr.getPos() ? + std::unique_ptr( + new DebugTraceStacker( + *evalState, + DebugTrace + {.pos = *expr.getPos(), + .expr = expr, + .env = env, + .hint = error->info().msg, + .is_error = true + })) + : nullptr; + + 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()); - else - { - auto iter = evalState->debugTraces.begin(); - if (iter != evalState->debugTraces.end()) { - std::cout << "\n" << "… " << iter->hint.str() << "\n"; - - if (iter->pos.has_value() && (*iter->pos)) { - auto pos = iter->pos.value(); - std::cout << "\n"; - printAtPos(pos, std::cout); - - auto loc = getCodeLines(pos); - if (loc.has_value()) { - std::cout << "\n"; - printCodeLines(std::cout, "", pos, *loc); - std::cout << "\n"; - } - } - } - } + + // else + // { + // auto iter = evalState->debugTraces.begin(); + // if (iter != evalState->debugTraces.end()) { + // std::cout << "\n" << "… " << iter->hint.str() << "\n"; + + // if (iter->pos.has_value() && (*iter->pos)) { + // auto pos = iter->pos.value(); + // std::cout << "\n"; + // printAtPos(pos, std::cout); + + // auto loc = getCodeLines(pos); + // if (loc.has_value()) { + // std::cout << "\n"; + // printCodeLines(std::cout, "", pos, *loc); + // std::cout << "\n"; + // } + // } + // } + // } if (expr.staticenv) { -- cgit v1.2.3 From 5cfd038bd8bcd65c45f08f6c3665cd49e6643714 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Wed, 6 Apr 2022 19:08:29 -0600 Subject: show expr pos if DebugTrace one is noPos --- src/libcmd/command.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 34535802f..cc353cbb4 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -129,7 +129,7 @@ ref EvalCommand::getEvalState() new DebugTraceStacker( *evalState, DebugTrace - {.pos = *expr.getPos(), + {.pos = (error->info().errPos ? *error->info().errPos : *expr.getPos()), .expr = expr, .env = env, .hint = error->info().msg, -- cgit v1.2.3 From f37562187f2673535a8e636e7ea5b37662b5a65a Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Thu, 7 Apr 2022 11:17:31 -0600 Subject: free valmap on exit --- src/libcmd/command.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index cc353cbb4..e3c8fb29f 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -164,7 +164,7 @@ ref EvalCommand::getEvalState() if (expr.staticenv) { - auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); + std::unique_ptr vm(mapStaticEnvBindings(*expr.staticenv.get(), env)); runRepl(evalState, error, expr, *vm); } }; -- cgit v1.2.3 From a86c2a8481c5bedb992d7126bc342a34b9c4902e Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 8 Apr 2022 13:30:18 -0600 Subject: remove 'debugError', dead code --- src/libcmd/command.cc | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 5cb8728e9..5ef3b4bc6 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -120,9 +120,6 @@ ref EvalCommand::getEvalState() ; if (startReplOnEvalErrors) debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { - // clear the screen. - // std::cout << "\033[2J\033[1;1H"; - auto dts = error && expr.getPos() ? std::unique_ptr( @@ -137,35 +134,13 @@ ref EvalCommand::getEvalState() })) : nullptr; - 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()); - // else - // { - // auto iter = evalState->debugTraces.begin(); - // if (iter != evalState->debugTraces.end()) { - // std::cout << "\n" << "… " << iter->hint.str() << "\n"; - - // if (iter->pos.has_value() && (*iter->pos)) { - // auto pos = iter->pos.value(); - // std::cout << "\n"; - // printAtPos(pos, std::cout); - - // auto loc = getCodeLines(pos); - // if (loc.has_value()) { - // std::cout << "\n"; - // printCodeLines(std::cout, "", pos, *loc); - // std::cout << "\n"; - // } - // } - // } - // } - if (expr.staticenv) { std::unique_ptr vm(mapStaticEnvBindings(*expr.staticenv.get(), env)); - runRepl(evalState, error, expr, *vm); + runRepl(evalState, expr, *vm); } }; } -- cgit v1.2.3 From 2a5632c70dcb686a7764c23a5f330fcb9a33c8a1 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 29 Apr 2022 10:02:17 -0600 Subject: incorporate PosIdx changes, symbol changes. --- src/libcmd/command.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 82b35d16f..3e789adba 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -126,7 +126,7 @@ ref EvalCommand::getEvalState() new DebugTraceStacker( *evalState, DebugTrace - {.pos = (error->info().errPos ? *error->info().errPos : *expr.getPos()), + {.pos = (error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()]), .expr = expr, .env = env, .hint = error->info().msg, @@ -139,7 +139,7 @@ ref EvalCommand::getEvalState() if (expr.staticenv) { - std::unique_ptr vm(mapStaticEnvBindings(*expr.staticenv.get(), env)); + std::unique_ptr vm(mapStaticEnvBindings(evalState->symbols, *expr.staticenv.get(), env)); runRepl(evalState, expr, *vm); } }; -- cgit v1.2.3 From 172a83d22a3c984b6b569b5528d2338059bb748b Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 29 Apr 2022 11:24:54 -0600 Subject: line endings --- src/libcmd/command.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 3e789adba..56d529461 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -125,7 +125,7 @@ ref EvalCommand::getEvalState() std::unique_ptr( new DebugTraceStacker( *evalState, - DebugTrace + DebugTrace {.pos = (error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()]), .expr = expr, .env = env, -- cgit v1.2.3 From dd8b91eebc0d31c9f8016609b36d89f58d8c4d19 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 5 May 2022 12:29:14 +0200 Subject: Style fixes In particular, use std::make_shared and enumerate(). Also renamed some fields to fit naming conventions. --- src/libcmd/command.cc | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 56d529461..12cd5ed83 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -121,25 +121,23 @@ ref EvalCommand::getEvalState() if (startReplOnEvalErrors) debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { auto dts = - error && expr.getPos() ? - std::unique_ptr( - new DebugTraceStacker( - *evalState, - DebugTrace - {.pos = (error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()]), - .expr = expr, - .env = env, - .hint = error->info().msg, - .is_error = true - })) - : nullptr; + error && expr.getPos() + ? std::make_unique( + *evalState, + DebugTrace { + .pos = error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()], + .expr = expr, + .env = env, + .hint = error->info().msg, + .isError = true + }) + : nullptr; 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()); - if (expr.staticenv) - { - std::unique_ptr vm(mapStaticEnvBindings(evalState->symbols, *expr.staticenv.get(), env)); + if (expr.staticEnv) { + auto vm = mapStaticEnvBindings(evalState->symbols, *expr.staticEnv.get(), env); runRepl(evalState, expr, *vm); } }; -- cgit v1.2.3 From 6faa56ea1f7f8b708e8c931f41b627541a023c79 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Sun, 15 May 2022 12:05:34 -0600 Subject: remove extra argument --- src/libcmd/command.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 12cd5ed83..bf97a3de8 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -138,7 +138,7 @@ ref EvalCommand::getEvalState() if (expr.staticEnv) { auto vm = mapStaticEnvBindings(evalState->symbols, *expr.staticEnv.get(), env); - runRepl(evalState, expr, *vm); + runRepl(evalState, *vm); } }; } -- cgit v1.2.3 From 667074b5867ffe40e3f1c59bd8e4ebf259f86aaa Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 16 May 2022 09:20:51 -0600 Subject: first whack at passing evalState as an arg to debuggerHook. --- src/libcmd/command.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index bf97a3de8..ee5102a6a 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -119,13 +119,14 @@ ref EvalCommand::getEvalState() #endif ; if (startReplOnEvalErrors) - debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { + // debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { + debuggerHook = [](const EvalState & evalState, const Error * error, const Env & env, const Expr & expr) { auto dts = error && expr.getPos() ? std::make_unique( - *evalState, + evalState, DebugTrace { - .pos = error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()], + .pos = error->info().errPos ? *error->info().errPos : evalState.positions[expr.getPos()], .expr = expr, .env = env, .hint = error->info().msg, @@ -137,8 +138,8 @@ ref EvalCommand::getEvalState() printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error->what()); if (expr.staticEnv) { - auto vm = mapStaticEnvBindings(evalState->symbols, *expr.staticEnv.get(), env); - runRepl(evalState, *vm); + auto vm = mapStaticEnvBindings(evalState.symbols, *expr.staticEnv.get(), env); + runRepl(*const_cast(&evalState), *vm); } }; } -- cgit v1.2.3 From 357fb84dbaad0b056704915c6a43764cda63ee7f Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Thu, 19 May 2022 10:48:10 -0600 Subject: use an expr->StaticEnv table in evalState --- src/libcmd/command.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index bf97a3de8..b8c3b0846 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -136,8 +136,9 @@ ref EvalCommand::getEvalState() 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()); - if (expr.staticEnv) { - auto vm = mapStaticEnvBindings(evalState->symbols, *expr.staticEnv.get(), env); + auto se = evalState->getStaticEnv(expr); + if (se) { + auto vm = mapStaticEnvBindings(evalState->symbols, *se.get(), env); runRepl(evalState, *vm); } }; -- cgit v1.2.3 From 7ddef73d026d79adc0c4f3fd1518d88d1331c38c Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Thu, 19 May 2022 12:44:40 -0600 Subject: de-const evalState exceptions --- src/libcmd/command.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 9cf2ff5e3..a7d7bfb17 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -118,9 +118,10 @@ ref EvalCommand::getEvalState() searchPath, getEvalStore(), getStore()) #endif ; + // TODO move this somewhere else. Its only here to get the evalState ptr! if (startReplOnEvalErrors) // debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { - debuggerHook = [](const EvalState & evalState, const Error * error, const Env & env, const Expr & expr) { + debuggerHook = [](EvalState & evalState, const Error * error, const Env & env, const Expr & expr) { auto dts = error && expr.getPos() ? std::make_unique( @@ -137,9 +138,9 @@ ref EvalCommand::getEvalState() 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()); - auto se = evalState->getStaticEnv(expr); + auto se = evalState.getStaticEnv(expr); if (se) { - auto vm = mapStaticEnvBindings(evalState->symbols, *se.get(), env); + auto vm = mapStaticEnvBindings(evalState.symbols, *se.get(), env); runRepl(evalState, *vm); } }; -- cgit v1.2.3 From 0600df86b8bc59633457f7ceb79e84c8ea3fed17 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Thu, 19 May 2022 17:01:23 -0600 Subject: 'debugMode' --- src/libcmd/command.cc | 53 +++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index a7d7bfb17..a4ea5bc33 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -118,32 +118,35 @@ ref EvalCommand::getEvalState() searchPath, getEvalStore(), getStore()) #endif ; + + evalState->debugMode = startReplOnEvalErrors; // TODO move this somewhere else. Its only here to get the evalState ptr! - if (startReplOnEvalErrors) - // debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { - debuggerHook = [](EvalState & evalState, const Error * error, const Env & env, const Expr & expr) { - auto dts = - error && expr.getPos() - ? std::make_unique( - evalState, - DebugTrace { - .pos = error->info().errPos ? *error->info().errPos : evalState.positions[expr.getPos()], - .expr = expr, - .env = env, - .hint = error->info().msg, - .isError = true - }) - : nullptr; - - 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()); - - auto se = evalState.getStaticEnv(expr); - if (se) { - auto vm = mapStaticEnvBindings(evalState.symbols, *se.get(), env); - runRepl(evalState, *vm); - } - }; + // if (startReplOnEvalErrors) + + // // debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { + // debuggerHook = [](EvalState & evalState, const Error * error, const Env & env, const Expr & expr) { + // auto dts = + // error && expr.getPos() + // ? std::make_unique( + // evalState, + // DebugTrace { + // .pos = error->info().errPos ? *error->info().errPos : evalState.positions[expr.getPos()], + // .expr = expr, + // .env = env, + // .hint = error->info().msg, + // .isError = true + // }) + // : nullptr; + + // 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()); + + // auto se = evalState.getStaticEnv(expr); + // if (se) { + // auto vm = mapStaticEnvBindings(evalState.symbols, *se.get(), env); + // runRepl(evalState, *vm); + // } + // }; } return ref(evalState); } -- cgit v1.2.3 From 884d59178735bcb5d5db7db97a05ad62a175493b Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 20 May 2022 10:33:50 -0600 Subject: debugRepl ftn pointer --- src/libcmd/command.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index a4ea5bc33..b61b9b61d 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -120,7 +120,34 @@ ref EvalCommand::getEvalState() ; evalState->debugMode = startReplOnEvalErrors; + // TODO move this somewhere else. Its only here to get the evalState ptr! + if (startReplOnEvalErrors) { + evalState->debugRepl = &runRepl; + }; + // // debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { + // debuggerHook = [](EvalState & evalState, const Error * error, const Env & env, const Expr & expr) { + // auto dts = + // error && expr.getPos() + // ? std::make_unique( + // evalState, + // DebugTrace { + // .pos = error->info().errPos ? *error->info().errPos : evalState.positions[expr.getPos()], + // .expr = expr, + // .env = env, + // .hint = error->info().msg, + // .isError = true + // }) + // : nullptr; + + // 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()); + + // auto se = evalState.getStaticEnv(expr); + // if (se) { + // auto vm = mapStaticEnvBindings(evalState.symbols, *se.get(), env); + // runRepl(evalState, *vm); + // } // if (startReplOnEvalErrors) // // debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { -- cgit v1.2.3 From 7ccb2700c0401c553631e07aeb49e08f976274a3 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Sun, 22 May 2022 19:15:58 -0600 Subject: comments --- src/libcmd/command.cc | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index b61b9b61d..c1d9eefc6 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -121,59 +121,9 @@ ref EvalCommand::getEvalState() evalState->debugMode = startReplOnEvalErrors; - // TODO move this somewhere else. Its only here to get the evalState ptr! if (startReplOnEvalErrors) { evalState->debugRepl = &runRepl; }; - // // debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { - // debuggerHook = [](EvalState & evalState, const Error * error, const Env & env, const Expr & expr) { - // auto dts = - // error && expr.getPos() - // ? std::make_unique( - // evalState, - // DebugTrace { - // .pos = error->info().errPos ? *error->info().errPos : evalState.positions[expr.getPos()], - // .expr = expr, - // .env = env, - // .hint = error->info().msg, - // .isError = true - // }) - // : nullptr; - - // 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()); - - // auto se = evalState.getStaticEnv(expr); - // if (se) { - // auto vm = mapStaticEnvBindings(evalState.symbols, *se.get(), env); - // runRepl(evalState, *vm); - // } - // if (startReplOnEvalErrors) - - // // debuggerHook = [evalState{ref(evalState)}](const Error * error, const Env & env, const Expr & expr) { - // debuggerHook = [](EvalState & evalState, const Error * error, const Env & env, const Expr & expr) { - // auto dts = - // error && expr.getPos() - // ? std::make_unique( - // evalState, - // DebugTrace { - // .pos = error->info().errPos ? *error->info().errPos : evalState.positions[expr.getPos()], - // .expr = expr, - // .env = env, - // .hint = error->info().msg, - // .isError = true - // }) - // : nullptr; - - // 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()); - - // auto se = evalState.getStaticEnv(expr); - // if (se) { - // auto vm = mapStaticEnvBindings(evalState.symbols, *se.get(), env); - // runRepl(evalState, *vm); - // } - // }; } return ref(evalState); } -- cgit v1.2.3 From 13d02af0799f5d2f7a53825936d587e22edcacb6 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Sun, 22 May 2022 21:45:24 -0600 Subject: remove redundant 'debugMode' flag --- src/libcmd/command.cc | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/libcmd/command.cc') diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index c1d9eefc6..7f8072d75 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -119,8 +119,6 @@ ref EvalCommand::getEvalState() #endif ; - evalState->debugMode = startReplOnEvalErrors; - if (startReplOnEvalErrors) { evalState->debugRepl = &runRepl; }; -- cgit v1.2.3