1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 04:21:16 +02:00

remove redundant 'debugMode' flag

This commit is contained in:
Ben Burdette 2022-05-22 21:45:24 -06:00
parent 7ccb2700c0
commit 13d02af079
6 changed files with 35 additions and 39 deletions

View file

@ -280,7 +280,7 @@ void NixRepl::mainLoop(const std::vector<std::string> & files)
// in debugger mode, an EvalError should trigger another repl session.
// when that session returns the exception will land here. No need to show it again;
// show the error for this repl session instead.
if (state.debugMode && !state.debugTraces.empty())
if (state.debugRepl && !state.debugTraces.empty())
showDebugTrace(std::cout, state.positions, state.debugTraces.front());
else
printMsg(lvlError, e.msg());
@ -493,7 +493,7 @@ bool NixRepl::processLine(std::string line)
<< " :log <expr> Show logs for a derivation\n"
<< " :te [bool] Enable, disable or toggle showing traces for errors\n"
;
if (state.debugMode) {
if (state.debugRepl) {
std::cout
<< "\n"
<< " Debug mode commands\n"
@ -508,14 +508,14 @@ bool NixRepl::processLine(std::string line)
}
else if (state.debugMode && (command == ":bt" || command == ":backtrace")) {
else if (state.debugRepl && (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 (state.debugMode && (command == ":env")) {
else if (state.debugRepl && (command == ":env")) {
for (const auto & [idx, i] : enumerate(state.debugTraces)) {
if (idx == debugTraceIndex) {
printEnvBindings(state, i.expr, i.env);
@ -524,7 +524,7 @@ bool NixRepl::processLine(std::string line)
}
}
else if (state.debugMode && (command == ":st")) {
else if (state.debugRepl && (command == ":st")) {
try {
// change the DebugTrace index.
debugTraceIndex = stoi(arg);
@ -542,13 +542,13 @@ bool NixRepl::processLine(std::string line)
}
}
else if (state.debugMode && (command == ":s" || command == ":step")) {
else if (state.debugRepl && (command == ":s" || command == ":step")) {
// set flag to stop at next DebugTrace; exit repl.
state.debugStop = true;
return false;
}
else if (state.debugMode && (command == ":c" || command == ":continue")) {
else if (state.debugRepl && (command == ":c" || command == ":continue")) {
// set flag to run to next breakpoint or end of program; exit repl.
state.debugStop = false;
return false;