I noticed the new interpreter and debugger both just had a release tagged. How usable are those? Purely internal dogfood alpha or something more palatable?
When I try the example on the README on Juno I get:
using Debugger
function foo(n)
x = n+1
((BigInt[1 1; 1 0])^x)[2,1]
end
@Debugger.enter foo(20)
UndefVarError: line not defined
Debugger.LineNumbers.SourceFile(::String) at LineNumbers.jl:19
print_sourcecode(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::String, ::Int64, ::Int64, ::Dict{Int64,JuliaInterpreter.BreakpointState}) at printing.jl:212
print_status(::Base.TTY, ::JuliaInterpreter.Frame) at printing.jl:101 #RunDebugger#3(::Bool, ::Function, ::JuliaInterpreter.Frame, ::REPL.LineEditREPL, ::REPL.Terminals.TTYTerminal) at repl.jl:92
RunDebugger(::JuliaInterpreter.Frame, ::REPL.LineEditREPL, ::REPL.Terminals.TTYTerminal) at repl.jl:4
RunDebugger(::JuliaInterpreter.Frame) at repl.jl:4
top-level scope at Debugger.jl:99
UndefVarError: line not defined
Debugger.LineNumbers.SourceFile(::String) at LineNumbers.jl:19
print_sourcecode(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::String, ::Int64, ::Int64, ::Int64, ::Dict{Int64,JuliaInterpreter.BreakpointState}) at printing.jl:216
#print_status#34(::Bool, ::Function, ::Base.TTY, ::JuliaInterpreter.Frame) at printing.jl:117
(::getfield(Debugger, Symbol("#kw##print_status")))(::NamedTuple{(:force_lowered,),Tuple{Bool}}, ::typeof(Debugger.print_status), ::Base.TTY, ::JuliaInterpreter.Frame) at none:0
#RunDebugger#6(::Bool, ::Function, ::JuliaInterpreter.Frame, ::REPL.LineEditREPL, ::REPL.Terminals.TTYTerminal) at repl.jl:102
RunDebugger(::JuliaInterpreter.Frame, ::REPL.LineEditREPL, ::REPL.Terminals.TTYTerminal) at repl.jl:4
RunDebugger(::JuliaInterpreter.Frame) at repl.jl:4
top-level scope at Debugger.jl:101
Ah, I see now how this can happen. If the input source file is completely empty
will never run and line will be undefined. I will fix that, but the underlying problem seems to be that somehow we don’t get the correct source code when running in Juno. I’ll try out Debugger in Juno and try figure it out.
I can’t replicate the empty buffer failure, could you say precisely how you reproduce it?
However, I’ve found another failure mode when you use Ctrl + enter to evaluate a function in a file but then you haven’t saved that file yet. The line information for that method will point to where it is in the unsaved file but when we try to look up the source code we get a bounds error because the saved file has fewer lines.
Edit: Ok, I figured it out, if the file is empty last time you saved it but have ctrl evaluated a function in that file, it will happen. A workaround is to save the file but I will fix it not to error.
Correct, saving the file before running the @enter macro solves the line not defined error…
…but…
then there is an other problem:
the debug commands then typed in the juno console (for example n for step to next line) do not “arrive” to the debugger:
That’s basically this bug.
Just type Debugger.@enter in the REPL instead of an editor, or use Juno’s own debugger integration (which you can access with Juno.@enter after updating).
Thank you, working…
Which is the relation between the Juno debugger and Debugger.jl ? Is the Juno debugger a GUI interface to Debugger.jl or are them different codebases ?