Files
lix/doc/manual/rl-next/repl-reverse-bt.md
T
blokyk f8b13b254b libcmd/repl: print backtraces from outer to innermost frame
before this change, the innermost frame was all the way at the top,
which means that in very nested code you'd have to scroll though
dozens or hundreds of frames before even seeing where you are, because
the last lines (which are immediately visible when the command returns)
would be the nix code's entry point and other outer frames instead,
which is rarely relevant.

this CL reverses this order, so that the innermost frames are the last
ones printed, and thus are immediately visible. (note that this is
already how errors are printed by nix in other contexts anyway, the
debugger's :bt is the only thing that prints the trace in "forward"
order.)

because `DebugState.traces()` use the homegrown `libutil::Generator`
instead of an stdlib container, we have to do that reversing ourselves,
in this case by just storing every element in an `std::list` (in reverse
order) and then traversing it. this is feels kinda dirty, but i don't
know any other way, and it's not exactly performance-critical.

Change-Id: I9f23e40e57f72a251d65a335b3bba3c3f77b935d
2026-04-28 12:09:13 +02:00

647 B

synopsis, issues, cls, category, credits
synopsis issues cls category credits
Print REPL backtraces in more convenient order
5491
Improvements
blokyk

When using the debugger, stack traces printed with the :bt command were previously printed in reverse order compared to most other situations where they appeared: the current stack frame would be printed at the very top, with the most outer frame at the bottom, meaning that you'd have to scroll up to get a sense of where you are.

With this change, the stack frames are printed such that the most relevant ones are immediatly visible at the bottom, just like other traces in lix (e.g. ones caused by errors).