Debugger.jl
Debugger.jl copied to clipboard
Debugger REPL has no memory
julia> function foo(x)
y = 2x
a = 1
return a + y
end
foo (generic function with 2 methods)
julia> @enter foo(3)
In foo(x) at REPL[13]:2
1 function foo(x)
>2 y = 2x
3 a = 1
4 return a + y
5 end
About to run: (*)(2, 3)
1|debug> n
In foo(x) at REPL[13]:2
1 function foo(x)
2 y = 2x
3 a = 1
>4 return a + y
5 end
About to run: (+)(1, 6)
1|julia> asdf = 1234 # I typed ` here to run code in the context of foo()
1234
1|julia> asdf
ERROR: UndefVarError: asdf not defined
Another issue with this example, unrelated to the title of this issue, is that when I hit n it ran both the y = 2x line and the a = 1 line. As far as I know, hitting n should only run one line.
n will take you to the next call.
Introducing new local variables is not supported, you can do global asdf =...
Oh, that's interesting. The docs seem to be misleading on that account:
n: step to the next linenc: step to the next call
Thanks for the global asdf tip! I guess that addresses the issue in the title.
Well, not really the next call but the next call that is on a line greater than the current line.
We should maybe make it more clear that we only ever care about calls, never about assignments etc.
Yeah, makes sense