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

stack traces basically working

This commit is contained in:
Ben Burdette 2021-12-22 19:40:08 -07:00
parent b4a59a5eec
commit bc20e54e00
3 changed files with 78 additions and 17 deletions

View file

@ -448,6 +448,26 @@ bool NixRepl::processLine(string line)
else if (command == ":d" || command == ":debug") {
std::cout << "debug: '" << arg << "'" << std::endl;
if (arg == "stack") {
std::cout << "eval stack:" << std::endl;
for (auto iter = this->state->debugTraces.begin();
iter != this->state->debugTraces.end(); ++iter) {
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 if (arg == "error") {
if (this->debugError.has_value()) {