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
72 lines
1.7 KiB
Plaintext
72 lines
1.7 KiB
Plaintext
https://github.com/NixOS/nix/pull/9917 (Enter debugger more reliably in let expressions and function calls)
|
|
|
|
This test ensures that continues don't skip opportunities to enter the debugger.
|
|
@args --debugger
|
|
trace: before outer break
|
|
info: breakpoint reached
|
|
|
|
nix-repl> :c
|
|
trace: before inner break
|
|
info: breakpoint reached
|
|
|
|
nix-repl> :bt
|
|
|
|
6: while evaluating the file '$TEST_DATA/regression_9917.nix':
|
|
$TEST_DATA/regression_9917.nix:1:1
|
|
|
|
1| let
|
|
| ^
|
|
2| a = builtins.trace "before inner break" (
|
|
|
|
5: while evaluating a 'let' expression
|
|
$TEST_DATA/regression_9917.nix:1:1
|
|
|
|
1| let
|
|
| ^
|
|
2| a = builtins.trace "before inner break" (
|
|
|
|
4: while calling a function
|
|
$TEST_DATA/regression_9917.nix:5:7
|
|
|
|
4| );
|
|
5| b = builtins.trace "before outer break" (
|
|
| ^
|
|
6| builtins.break a
|
|
|
|
3: while calling a function
|
|
$TEST_DATA/regression_9917.nix:6:5
|
|
|
|
5| b = builtins.trace "before outer break" (
|
|
6| builtins.break a
|
|
| ^
|
|
7| );
|
|
|
|
2: while calling a function
|
|
$TEST_DATA/regression_9917.nix:2:7
|
|
|
|
1| let
|
|
2| a = builtins.trace "before inner break" (
|
|
| ^
|
|
3| builtins.break { msg = "hello"; }
|
|
|
|
1: while calling a function
|
|
$TEST_DATA/regression_9917.nix:3:5
|
|
|
|
2| a = builtins.trace "before inner break" (
|
|
3| builtins.break { msg = "hello"; }
|
|
| ^
|
|
4| );
|
|
|
|
0: error: breakpoint reached
|
|
$TEST_DATA/regression_9917.nix:3:5
|
|
|
|
2| a = builtins.trace "before inner break" (
|
|
3| builtins.break { msg = "hello"; }
|
|
| ^
|
|
4| );
|
|
|
|
nix-repl> :c
|
|
|
|
nix-repl> msg
|
|
"hello"
|