Debugging 当单步执行函数时,获取Undereferror

Debugging 当单步执行函数时,获取Undereferror,debugging,julia,juno-ide,Debugging,Julia,Juno Ide,(我在中问了同样的问题,这是,如果你感兴趣的话) 大家好,我是朱莉娅的新朋友。我试着从中运行和调试代码“test/runtests.jl”(我主要想对这段代码进行单行调试,并研究它是如何工作的) 我已经查阅了相关文件,包括 “test/runtests.jl”可以成功运行 另外,因为juno不支持调试非函数文件,所以我做了一个小改动 …… …… # Graph Stein discrepancy bounded test function gsdbt() res = gsd(points

(我在中问了同样的问题,这是,如果你感兴趣的话)

大家好,我是朱莉娅的新朋友。我试着从中运行和调试代码“test/runtests.jl”(我主要想对这段代码进行单行调试,并研究它是如何工作的) 我已经查阅了相关文件,包括

“test/runtests.jl”可以成功运行

另外,因为juno不支持调试非函数文件,所以我做了一个小改动

……
……
# 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
此时,它仍然成功运行,包括调试模式

但我的目的是进入gsd功能(在中定义) 所以我设置了断点并
Juno。@在repl中输入gsdbt()
。然后我按下“下一个表达式”按钮,直到我认为可以进入这个函数的那一刻(如下所示),然后我按下“进入函数”。错误如下所示

如果我键入
Juno。@在repl中输入gsd(…)
,则直接得到Undereferror

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>:?
julia>Juno。@输入gsd(points=UNIFORM\u TESTDATA[:,1],gradlogdensity=UNIFORM\u gradlogp,solver=solver,supportlowerbounds=[0.0],supportupperbounds=[1.0])
错误:未定义引用错误:访问未定义引用
堆栈跟踪:
[1] 在/home/nick/.julia/v0.6/ASTInterpreter2/src/exploration.jl:3中查找变量(::ASTInterpreter2.JuliaStackFrame,::SSAValue)
[2] 在/home/nick/.julia/v0.6/ASTInterpreter2/src/expert.jl:32中评估调用(::ASTInterpreter2.JuliaStackFrame,::Expr)
[3] _step_expr(::ASTInterpreter2.JuliaStackFrame,::ASTInterpreter2.JuliaProgramCounter)位于/home/nick/.julia/v0.6/ASTInterpreter2/src/expert.jl:87
[4] 下一个直到!(::ASTInterpreter2.#7#8,::ASTInterpreter2.JuliaStackFrame,::ASTInterpreter2.JuliaProgramCounter)位于/home/nick/.julia/v0.6/ASTInterpreter2/src/expression.jl:144
[5] 也许你要穿过包装纸!(::数组{ASTInterpreter2.JuliaStackFrame,1})位于/home/nick/.julia/v0.6/ASTInterpreter2/src/ASTInterpreter2.jl:429
[6] 宏扩展位于/home/nick/.julia/v0.6/Atom/src/repl.jl:118[内联]
[7] 匿名地址:/?

这看起来像是调试器中的错误。您可以在(调试器的后端)尝试文件(可复制)问题。

这看起来像是调试器中的错误。您可以在(调试器的后端)尝试文件(可复制)问题

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
ERROR: Must provide non-empty array of sample points
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>:?