Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger cannot get locals in some instances #8827

Closed
lf- opened this issue Aug 15, 2023 · 3 comments · Fixed by #9918
Closed

Debugger cannot get locals in some instances #8827

lf- opened this issue Aug 15, 2023 · 3 comments · Fixed by #9918
Labels

Comments

@lf-
Copy link
Member

lf- commented Aug 15, 2023

cc @DieracDelta this was the bug I was talking about

Describe the bug

The debugger sometimes doesn't have locals. This can be quite frustrating and it is a major reason I don't reach for the debugger as much as I'd like to.

Steps To Reproduce

bug.nix:

let r = [];
x = builtins.throw r;
in x
$ nix eval --debugger -f bug.nix
error: cannot coerce a list to a string

       at /home/jade/dev/nixpkgs/bug.nix:2:5:

            1| let r = [];
            2| x = builtins.throw r;
             |     ^
            3| in x


Starting REPL to allow you to inspect the current state of the evaluator.

Welcome to Nix 2.13.3. Type :? for help.

nix-repl> r
error: undefined variable 'r'

       at «string»:1:1:

            1| r
             | ^

nix-repl> :env
Env level 0
builtins true false null scopedImport import isNull break abort throw derivationStrict placeholder baseNameOf dirOf removeAttrs map toString fetchMercurial fetchTree
 fetchTarball fetchGit fromTOML derivation 

Expected behavior

I should be able to get the value of r

nix-env --version output

nix-env (Nix) 2.13.3

Additional context

Add any other context about the problem here.

Priorities

Add 👍 to issues you find important.

@lf- lf- added the bug label Aug 15, 2023
@kjeremy
Copy link

kjeremy commented Aug 21, 2023

I can reproduce this with:
a.nix

let a = 1; b = 2; in builtins.break b == 2

nix eval --debugger -f a.nix

@lf-
Copy link
Member Author

lf- commented Aug 21, 2023

Yeah I've hit many cases isomorphic to yours @kjeremy. I think it might be that the variables are defined at the top level or something? The exact conditions that trigger this aren't clear but this bug really sucks.

@lf-
Copy link
Member Author

lf- commented Sep 9, 2023

possible workaround: (_: builtins.break _) some-expr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants