diff options
author | Ben Burdette <bburdette@protonmail.com> | 2022-05-05 21:23:03 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@protonmail.com> | 2022-05-05 21:23:03 -0600 |
commit | 99d69ac23faf06598ca0aabd61d22a575db848df (patch) | |
tree | e3a7ae8dd4ed0c4ac412bf6261742f47fe47124f /src/libcmd/repl.cc | |
parent | dea998b2f29eaad67b3003550fcfdf9d31045d4c (diff) |
fix repl bug
Diffstat (limited to 'src/libcmd/repl.cc')
-rw-r--r-- | src/libcmd/repl.cc | 75 |
1 files changed, 36 insertions, 39 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 950195572..8f0b1bfc0 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -506,53 +506,50 @@ bool NixRepl::processLine(std::string line) } - else if (debuggerHook) { - - if (command == ":bt" || command == ":backtrace") { - for (const auto & [idx, i] : enumerate(state->debugTraces)) { - std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": "; - showDebugTrace(std::cout, state->positions, i); - } + else if (debuggerHook && (command == ":bt" || command == ":backtrace")) { + for (const auto & [idx, i] : enumerate(state->debugTraces)) { + std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": "; + showDebugTrace(std::cout, state->positions, i); } + } - else if (command == ":env") { - for (const auto & [idx, i] : enumerate(state->debugTraces)) { - if (idx == debugTraceIndex) { - printEnvBindings(state->symbols, i.expr, i.env); - break; - } + else if (debuggerHook && (command == ":env")) { + for (const auto & [idx, i] : enumerate(state->debugTraces)) { + if (idx == debugTraceIndex) { + printEnvBindings(state->symbols, i.expr, i.env); + break; } } + } - else if (command == ":st") { - try { - // change the DebugTrace index. - debugTraceIndex = stoi(arg); - } catch (...) { } - - for (const auto & [idx, i] : enumerate(state->debugTraces)) { - if (idx == debugTraceIndex) { - std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": "; - showDebugTrace(std::cout, state->positions, i); - std::cout << std::endl; - printEnvBindings(state->symbols, i.expr, i.env); - loadDebugTraceEnv(i); - break; - } - } + else if (debuggerHook && (command == ":st")) { + try { + // change the DebugTrace index. + debugTraceIndex = stoi(arg); + } catch (...) { } + + for (const auto & [idx, i] : enumerate(state->debugTraces)) { + if (idx == debugTraceIndex) { + std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": "; + showDebugTrace(std::cout, state->positions, i); + std::cout << std::endl; + printEnvBindings(state->symbols, i.expr, i.env); + loadDebugTraceEnv(i); + break; + } } + } - else if (command == ":s" || command == ":step") { - // set flag to stop at next DebugTrace; exit repl. - state->debugStop = true; - return false; - } + else if (debuggerHook && (command == ":s" || command == ":step")) { + // set flag to stop at next DebugTrace; exit repl. + state->debugStop = true; + return false; + } - else if (command == ":c" || command == ":continue") { - // set flag to run to next breakpoint or end of program; exit repl. - state->debugStop = false; - return false; - } + else if (debuggerHook && (command == ":c" || command == ":continue")) { + // set flag to run to next breakpoint or end of program; exit repl. + state->debugStop = false; + return false; } else if (command == ":a" || command == ":add") { |