New debugger?

Hello,

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?

I’m talking about these: JuliaDebug · GitHub

Thanks!

S

Edit: thanks for all the hard work :slight_smile:

9 Likes

Try it out and report back :slight_smile:

9 Likes

Is this real live? :smiley:

2 Likes

I’ve been using it for a couple of days, it already saved me a ton of time. Awesome work!!

7 Likes

Any plans to get it working with Atom/Juno? @pfitzseb

Yes, for a dog with a very discriminating taste. :wink:

3 Likes

Try it out and report back :slight_smile:

OK I’ll try it out when I have time. :slight_smile:

Any reason Debugger.jl is not registered?

https://github.com/JuliaLang/METADATA.jl/pull/22216

4 Likes

I’ve used Debugger on simple functions and it works really great!

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

works for me. Did you try updating Debugger and JuliaInterpreter?

If you can reproduce, please list the version of packages used.

I freed/updated to Debugger v0.2.1 (I had v0.1.0), restarted Julia, but I still have the error (only in Juno, in the REPL I have no problem):

(v1.1) pkg> status
    Status `~/.julia/environments/v1.1/Project.toml`
  [c52e3926] Atom v0.8.1
  [6e4b80f9] BenchmarkTools v0.4.2
  [336ed68f] CSV v0.4.3
  [a93c6f00] DataFrames v0.17.1
  [1313f7d8] DataFramesMeta v0.4.1
  [864edb3b] DataStructures v0.15.0
  [31a5f54b] Debugger v0.2.1
  [31c24e10] Distributions v0.17.0
  [bd48cda9] GraphRecipes v0.4.0
  [7073ff75] IJulia v1.18.0
  [6deec6e2] IndexedTables v0.10.0
  [e5e0dc1b] Juno v0.6.0
  [aba2b823] LAJuliaUtils v0.0.0 [`~/.julia/dev/LAJuliaUtils`]
  [2fda8390] LsqFit v0.8.0
  [e4e893b0] Mimi v0.8.1
  [51fcb6bd] NamedColors v0.2.0
  [56b0d19f] OdsIO v0.5.0
  [91a5bcdd] Plots v0.23.2
  [438e738f] PyCall v1.90.0
  [d330b81b] PyPlot v2.8.0
  [295af30f] Revise v2.0.0
  [f3b207a7] StatsPlots v0.10.2
  [24249f21] SymPy v0.9.0
  [37b6cedf] Traceur v0.3.0
  [0ae4a718] VegaDatasets v0.5.0
  [112f6efa] VegaLite v0.6.0
  [c2297ded] ZMQ v1.0.0
  [9a3f8284] Random

The error stack has marginally changed:

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.

3 Likes

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.

1 Like

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:

(in the above screenshot I did type n)

1 Like

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).

2 Likes

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 ?

1 Like

They are completly separate implementations on top of JuliaInterpreter.jl, which does most of the heavy lifting.

6 Likes