lix/tests/functional/repl_characterization/data/debug_frames.test
eldritch horrors 3593f5555e libexpr: handle debug trace frames as parent pointer list
this also fixes a debugger bug where leaving the debugger does not clean
up old debugger state completely. in such cases the fake frame withFrame
created was left behind after the corresponding caller frame was unwound

Change-Id: I45adcd116276b03b2f87076518c9eae6fe844e06
2024-11-28 15:12:22 +00:00

114 lines
3.6 KiB
Plaintext

@args --debugger
:c at the root repl is not allowed since no debugger is running yet
nix-repl> :c
error: unknown command ':c'
:c and other commands become available once a debugger starts
nix-repl> with {}; a
error: undefined variable 'a'
at «string»:1:10:
1| with {}; a
| ^
nix-repl> :?
The following commands are available:
<expr> Evaluate and print expression
<x> = <expr> Bind expression to variable
:a, :add <expr> Add attributes from resulting set to scope
:b <expr> Build a derivation
:bl <expr> Build a derivation, creating GC roots in the
working directory
:e, :edit <expr> Open package or function in $EDITOR
:i <expr> Build derivation, then install result into
current profile
:l, :load <path> Load Nix expression and add it to scope
:lf, :load-flake <ref> Load Nix flake and add it to scope
:p, :print <expr> Evaluate and print expression recursively
Strings are printed directly, without escaping.
:q, :quit Exit nix-repl
:r, :reload Reload all files
:sh <expr> Build dependencies of derivation, then start
nix-shell
:t <expr> Describe result of evaluation
:u <expr> Build derivation, then start nix-shell
:doc <expr> Show documentation for the provided function (experimental lambda support)
:log <expr | .drv path> Show logs for a derivation
:te, :trace-enable [bool] Enable, disable or toggle showing traces for
errors
:?, :help Brings up this help menu
Debug mode commands
:env Show env stack
:bt, :backtrace Show trace stack
:st Show current trace
:st <idx> Change to another trace in the stack
:c, :continue Go until end of program, exception, or builtins.break
:s, :step Go one step
we can now inspect state
nix-repl> :bt
0: error: undefined variable 'a'
«string»:1:10
1| with {}; a
| ^
1: error: Fake frame for debugging purposes
«string»:1:10
1| with {}; a
| ^
and resume execution
nix-repl> :c
error: undefined variable 'a'
at «string»:1:10:
1| with {}; a
| ^
the debugger is once again disabled
nix-repl> :c
error: unknown command ':c'
leaving the debugger from a toplevel error and entering it again doesn't leave old frames visible
nix-repl> with {}; a
error: undefined variable 'a'
at «string»:1:10:
1| with {}; a
| ^
nix-repl> :s
error: undefined variable 'a'
at «string»:1:10:
1| with {}; a
| ^
nix-repl> with {}; b
error: undefined variable 'b'
at «string»:1:10:
1| with {}; b
| ^
nix-repl> :bt
0: error: undefined variable 'b'
«string»:1:10
1| with {}; b
| ^
1: error: Fake frame for debugging purposes
«string»:1:10
1| with {}; b
| ^
exiting from here prints the error
nix-repl> :q
error: undefined variable 'b'
at «string»:1:10:
1| with {}; b
| ^