1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 17:51:15 +02:00

DebugTrace

This commit is contained in:
Ben Burdette 2021-12-23 13:36:39 -07:00
parent deb1fd66e8
commit e5eebda194
5 changed files with 29 additions and 18 deletions

View file

@ -84,7 +84,7 @@ ref<EvalState> EvalCommand::getEvalState()
if (expr.staticenv)
{
auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env);
runRepl(evalState, ref<const Error>(&error), *vm);
runRepl(evalState, &error, *vm);
}
};
}

View file

@ -314,8 +314,6 @@ void printClosureDiff(
void runRepl(
ref<EvalState> evalState,
std::optional<ref<const Error>> debugError,
const Error *debugError,
const std::map<std::string, Value *> & extraEnv);
}

View file

@ -50,7 +50,7 @@ struct NixRepl
ref<EvalState> state;
Bindings * autoArgs;
std::optional<ref<const Error>> debugError;
const Error *debugError;
Strings loadedFiles;
@ -470,13 +470,12 @@ bool NixRepl::processLine(string line)
}
else if (arg == "error") {
if (this->debugError.has_value()) {
// TODO user --show-trace setting?
showErrorInfo(std::cout, (*debugError)->info(), true);
if (this->debugError) {
showErrorInfo(std::cout, debugError->info(), true);
}
else
{
notice("error information not available");
notice("error information not available");
}
}
}
@ -893,7 +892,7 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
void runRepl(
ref<EvalState> evalState,
std::optional<ref<const Error>> debugError,
const Error *debugError,
const std::map<std::string, Value *> & extraEnv)
{
auto repl = std::make_unique<NixRepl>(evalState);