Open mattcbro opened 5 years ago
do
block is just syntax for creating an anonymous function so you need to step into that call with e.g. s
:
julia> function f(x)
y = map(x) do z
z^2
end
return y
end;
julia> @enter f([1,2,3])
In f(x) at REPL[7]:2
1 function f(x)
>2 y = map(x) do z
3 z^2
4 end
5 return y
6 end;
About to run: (map)(getfield(Main, Symbol("##7#8"))(), [1, 2, 3])
In this example the do
block that we want to step into is the function getfield(Main, Symbol("##7#8"))()
so with s
we can first step into map
and then finally the anonymous function will be called. Since there can be a large number of steps until the function is called it can be nice to set a breakpoint like:
julia> function f(x)
y = map(x) do z
@bp
z^2
end
return y
end;
julia> @run f([1,2,3])
Hit breakpoint:
In #17(z) at REPL[10]:3
1 function f(x)
2 y = map(x) do z
●3 @bp
>4 z^2
5 end
6 return y
7 end;
The debugger won't step through do file loops, commonly used in file IO syntax. This has been true actually since the days of ASTInterpreter2.jl . I provide a simple example that creates an HDF5 file, though I think the problem is more general than this. In some of my more complicated IO functions, JuliaInterpreter will just hang within said loop.
If you step through the code using the n command it will simply skip past the do file loop.