Debugger.jl
Debugger.jl copied to clipboard
`sl` doesn't work as i had hoped if left-hand side indexes
i would rather sl in the example below step into foo, and it does precisely that if line 3 of bar has y instead of y[2] in the LHS. is this the intended before, or a bug? is there a command to step into foo? thanks.
julia> using Debugger
julia> function foo(x)
x+= 1
return x
end
foo (generic function with 1 method)
julia> function bar(x)
y=1:3
y[2] = foo(x[3])
return y.+1
end
bar (generic function with 1 method)
julia> x=1:100
1:100
julia> @enter bar(x)
In bar(x) at REPL[3]:1
1 function bar(x)
>2 y=1:3
3 y[2] = foo(x[3])
4 return y.+1
5 end
About to run: (Colon())(1, 3)
1|debug> n
In bar(x) at REPL[3]:1
1 function bar(x)
2 y=1:3
>3 y[2] = foo(x[3])
4 return y.+1
5 end
About to run: (getindex)(1:100, 3)
1|debug> sl
In setindex!(A, v, I) at abstractarray.jl:1341
1341 function setindex!(A::AbstractArray, v, I...)
1342 @_propagate_inbounds_meta
>1343 error_if_canonical_setindex(IndexStyle(A), A, I...)
1344 _setindex!(IndexStyle(A), A, v, to_indices(A, I)...)
1345 end
About to run: (IndexStyle)(1:3)
1|debug>
y[2] is a function call that occurs later than the rest which is why that get picked. I guess sl could be special cased to ignore setindex!.