调试step into function时,报错UndefRefError


#1

问题之前在英文论坛发过,转一下看看大家有没有新思路。

ubuntu 16.04.5
julia 0.6.4
atom 1.41.0

Hi all, I am new to julia. I try to run and debug the code “test/runtests.jl” from https://github.com/jgorham/SteinDiscrepancy.jl(I mainly want to single-line debug this code and study how it works.)
I have reviewed the relevant documentation, including https://docs.junolab.org/latest/man/debugging/

“test/runtests.jl” can run successfully,

In addition, because juno does not support debugging the non-function file,so I made a small change.

...
....
# Graph Stein discrepancy bounded test
function gsdbt()
    res = gsd(points=UNIFORM_TESTDATA[:,1],
              gradlogdensity=uniform_gradlogp,
              solver=solver,
              supportlowerbounds=[0.0],
              supportupperbounds=[1.0])
end

At this point it still runs successfully, including the debug mode.

but my purpose is to step into the gsd function(which defined in src/discrepancy/stein_discrepancy.jl)
so i set the breakpoint and Juno.@enter gsdbt() in repl. Then i press “next expression” button until the moment i think can enter this function(as shown below), and i press “step into the function”.The error came out like below.
image

julia> Juno.@enter gsdbt()
ERROR: UndefRefError: access to undefined reference
Stacktrace:
 [1] startdebugging(::Array{ASTInterpreter2.JuliaStackFrame,1}) at /home/nick/.julia/v0.6/Atom/src/debugger/stepper.jl:104
 [2] macro expansion at /home/nick/.julia/v0.6/Atom/src/repl.jl:118 [inlined]
 [3] anonymous at ./<missing>:?
 [4] eval(::Module, ::Any) at ./boot.jl:235
 [5] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
 [6] macro expansion at ./REPL.jl:97 [inlined]
 [7] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73

I want to step into the gsd function, but i got UndefRefError.
How can I solve it? Thank you very much.

——————Here are some weird phenomena that may be helpful to you.——————

Also, i try to enter Juno.@enter gsd() ( not gsdbt ), I am surprised that Atom automatically switches out a file(.julia/v0.6/SteingDiscrepancy/src/disvrepancy), But I put this project on the desktop, that means they are two files (although the content is the same).

Then an expected error occurred.
ERROR: Must provide non-empty array of sample points

If i type Juno.@enter gsd(……) in repl, got UndefRefError directly

julia> Juno.@enter gsd(points=UNIFORM_TESTDATA[:,1],gradlogdensity=uniform_gradlogp,solver=solver,supportlowerbounds=[0.0],supportupperbounds=[1.0])

ERROR: UndefRefError: access to undefined reference
Stacktrace:
 [1] lookup_var(::ASTInterpreter2.JuliaStackFrame, ::SSAValue) at /home/nick/.julia/v0.6/ASTInterpreter2/src/interpret.jl:3
 [2] evaluate_call(::ASTInterpreter2.JuliaStackFrame, ::Expr) at /home/nick/.julia/v0.6/ASTInterpreter2/src/interpret.jl:32
 [3] _step_expr(::ASTInterpreter2.JuliaStackFrame, ::ASTInterpreter2.JuliaProgramCounter) at /home/nick/.julia/v0.6/ASTInterpreter2/src/interpret.jl:87
 [4] next_until!(::ASTInterpreter2.##7#8, ::ASTInterpreter2.JuliaStackFrame, ::ASTInterpreter2.JuliaProgramCounter) at /home/nick/.julia/v0.6/ASTInterpreter2/src/interpret.jl:144
 [5] maybe_step_through_wrapper!(::Array{ASTInterpreter2.JuliaStackFrame,1}) at /home/nick/.julia/v0.6/ASTInterpreter2/src/ASTInterpreter2.jl:429
 [6] macro expansion at /home/nick/.julia/v0.6/Atom/src/repl.jl:118 [inlined]
 [7] anonymous at ./<missing>:?