forked from lix-project/lix
fix repl bug
This commit is contained in:
parent
dea998b2f2
commit
99d69ac23f
|
@ -506,53 +506,50 @@ bool NixRepl::processLine(std::string line)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (debuggerHook) {
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (command == ":bt" || command == ":backtrace") {
|
else if (debuggerHook && (command == ":env")) {
|
||||||
for (const auto & [idx, i] : enumerate(state->debugTraces)) {
|
for (const auto & [idx, i] : enumerate(state->debugTraces)) {
|
||||||
std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": ";
|
if (idx == debugTraceIndex) {
|
||||||
showDebugTrace(std::cout, state->positions, i);
|
printEnvBindings(state->symbols, i.expr, i.env);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if (command == ":env") {
|
else if (debuggerHook && (command == ":st")) {
|
||||||
for (const auto & [idx, i] : enumerate(state->debugTraces)) {
|
try {
|
||||||
if (idx == debugTraceIndex) {
|
// change the DebugTrace index.
|
||||||
printEnvBindings(state->symbols, i.expr, i.env);
|
debugTraceIndex = stoi(arg);
|
||||||
break;
|
} 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 == ":st") {
|
else if (debuggerHook && (command == ":s" || command == ":step")) {
|
||||||
try {
|
// set flag to stop at next DebugTrace; exit repl.
|
||||||
// change the DebugTrace index.
|
state->debugStop = true;
|
||||||
debugTraceIndex = stoi(arg);
|
return false;
|
||||||
} catch (...) { }
|
}
|
||||||
|
|
||||||
for (const auto & [idx, i] : enumerate(state->debugTraces)) {
|
else if (debuggerHook && (command == ":c" || command == ":continue")) {
|
||||||
if (idx == debugTraceIndex) {
|
// set flag to run to next breakpoint or end of program; exit repl.
|
||||||
std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": ";
|
state->debugStop = false;
|
||||||
showDebugTrace(std::cout, state->positions, i);
|
return false;
|
||||||
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 (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") {
|
else if (command == ":a" || command == ":add") {
|
||||||
|
|
Loading…
Reference in a new issue