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:
parent
b4a59a5eec
commit
bc20e54e00
3 changed files with 78 additions and 17 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue