# New debugger?

**URL:** <https://discourse.julialang.org/t/new-debugger/21974>\
**Category:** Tooling\
**Created:** [March 17, 2019, 9:16pm UTC](https://discourse.julialang.org/t/new-debugger/21974 "2019-03-17T21:16:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![loisel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loisel/32/50626_2.png) [@loisel](https://discourse.julialang.org/u/loisel)\
**Post date:** [March 17, 2019, 9:16pm UTC](https://discourse.julialang.org/t/new-debugger/21974/1 "2019-03-17T21:16:15Z")

</div>

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](https://github.com/JuliaDebug)

Thanks!

S

Edit: thanks for all the hard work 🙂

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 17, 2019, 9:32pm UTC](https://discourse.julialang.org/t/new-debugger/21974/2 "2019-03-17T21:32:29Z")

</div>

Try it out and report back 🙂

---

<div class="post-metadata">

**Author:** ![tamasgal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamasgal/32/27946_2.png) [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Post date:** [March 17, 2019, 10:56pm UTC](https://discourse.julialang.org/t/new-debugger/21974/3 "2019-03-17T22:56:57Z")

</div>

Is this real live? 😃

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [March 17, 2019, 10:58pm UTC](https://discourse.julialang.org/t/new-debugger/21974/4 "2019-03-17T22:58:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sairus7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sairus7/32/10816_2.png) [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Post date:** [March 18, 2019, 3:11am UTC](https://discourse.julialang.org/t/new-debugger/21974/5 "2019-03-18T03:11:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 18, 2019, 9:01am UTC](https://discourse.julialang.org/t/new-debugger/21974/6 "2019-03-18T09:01:39Z")

</div>

> [@loisel](#):
>
> Purely internal dogfood alpha

Yes, for a dog with a very discriminating taste. 😉

---

<div class="post-metadata">

**Author:** ![loisel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loisel/32/50626_2.png) [@loisel](https://discourse.julialang.org/u/loisel)\
**Post date:** [March 18, 2019, 8:02pm UTC](https://discourse.julialang.org/t/new-debugger/21974/7 "2019-03-18T20:02:25Z")

</div>

> Try it out and report back 🙂

OK I’ll try it out when I have time. 🙂

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [March 18, 2019, 11:12pm UTC](https://discourse.julialang.org/t/new-debugger/21974/8 "2019-03-18T23:12:06Z")

</div>

Any reason `Debugger.jl` is not registered?

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [March 19, 2019, 12:59am UTC](https://discourse.julialang.org/t/new-debugger/21974/9 "2019-03-19T00:59:01Z")

</div>

[https://github.com/JuliaLang/METADATA.jl/pull/22216](https://github.com/JuliaLang/METADATA.jl/pull/22216)

---

<div class="post-metadata">

**Author:** ![Balinus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/balinus/32/243_2.png) [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Post date:** [March 19, 2019, 3:15pm UTC](https://discourse.julialang.org/t/new-debugger/21974/10 "2019-03-19T15:15:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [March 19, 2019, 4:12pm UTC](https://discourse.julialang.org/t/new-debugger/21974/11 "2019-03-19T16:12:16Z")

</div>

When I try the example on the README on Juno I get:

```julia
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

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [March 20, 2019, 7:20pm UTC](https://discourse.julialang.org/t/new-debugger/21974/12 "2019-03-20T19:20:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 20, 2019, 7:22pm UTC](https://discourse.julialang.org/t/new-debugger/21974/13 "2019-03-20T19:22:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [March 21, 2019, 9:17am UTC](https://discourse.julialang.org/t/new-debugger/21974/14 "2019-03-21T09:17:48Z")

</div>

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

```julia
(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:

```julia
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

```

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 21, 2019, 9:25am UTC](https://discourse.julialang.org/t/new-debugger/21974/15 "2019-03-21T09:25:16Z")

</div>

Ah, I see now how this can happen. If the input source file is completely empty

> <https://github.com/JuliaDebug/Debugger.jl/blob/79dc17b7a065f57f8c682671cc3e31748313123c/src/LineNumbers.jl#L16>

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.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 21, 2019, 9:42am UTC](https://discourse.julialang.org/t/new-debugger/21974/16 "2019-03-21T09:42:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [March 21, 2019, 10:44am UTC](https://discourse.julialang.org/t/new-debugger/21974/17 "2019-03-21T10:44:37Z")

</div>

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

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/e/4ea4599800d163e3a12fa3721459fab14fe469e9.png)

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [March 21, 2019, 10:50am UTC](https://discourse.julialang.org/t/new-debugger/21974/18 "2019-03-21T10:50:56Z")

</div>

That’s basically [this bug](https://github.com/JunoLab/Juno.jl/issues/118).  
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).

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [March 21, 2019, 11:04am UTC](https://discourse.julialang.org/t/new-debugger/21974/19 "2019-03-21T11:04:22Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [March 21, 2019, 11:05am UTC](https://discourse.julialang.org/t/new-debugger/21974/20 "2019-03-21T11:05:17Z")

</div>

> [@sylvaticus](#):
>
> 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 ?

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

[Next page](https://discourse.julialang.org/t/new-debugger/21974.md?page=2)
