# Debugger status and future plans?

**URL:** <https://discourse.julialang.org/t/debugger-status-and-future-plans/43638>\
**Category:** Community\
**Tags:** question, debug\
**Created:** [July 24, 2020, 9:07pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638 "2020-07-24T21:07:21Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 25, 2020, 4:01pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/21 "2020-07-25T16:01:46Z")

</div>

This is _not_ a problem. Julia is conducive to using TDD and small functions. It is possible to avoid using the debugger. Using the REPL w/o a debugger indicates an advantage of Julia, not a disadvantage.

Edit: Disambiguated.

---

<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:** [July 25, 2020, 4:36pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/22 "2020-07-25T16:36:04Z")

</div>

The Julia debugger works pretty well in terms of correctness and features but it is indeed slow. It is likely a different approach than the current is needed to get significant speedups. I don’t know of anyone working on that, at the moment.

As a note, Julia is actually pretty hard to interpret quickly. Julia code gets written with the assumption that abstractions will optimize away, which isn’t the case in the interpreter. Stepping through a simple indexing into an array is pretty illuminating, showing how much stuff the Interpreter executed vs what in compiled mode turns into a few assembly instructions.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [July 25, 2020, 4:52pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/23 "2020-07-25T16:52:28Z")

</div>

I use the debugger on VSC all the time and level of satisfaction is moderate. IMO, debugging in Julia is so fundamental needed as in C or Matlab (my experience). It’s very nice to say that small functions and unit test find bugs easily. But what about FIXING them?

One thing I find annoying is to to step into a function. Often I need to step in and out lots of other functions that are implicit in the function arguments. Another thing is that it not-so-rarely does not stop at the breakpoints.

In summary, things have improved a LOT (really thankful for that) but when I compare it with the Matlab/VS experience … it’s still not there.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [July 25, 2020, 5:02pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/24 "2020-07-25T17:02:22Z")

</div>

> [@PetrKryslUCSD](#):
>
> Using the REPL w/o a debugger indicates an advantage of Julia, not a disadvantage.

I don’t see the connection between using the REPL and not using a debugger.

Also, debuggers can be used for exploring codebases. It’s extremely useful, and I don’t frankly understand how it’s possible to understand code without stepping through it.

Fortunately, Julia has both.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 25, 2020, 5:11pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/25 "2020-07-25T17:11:44Z")

</div>

I am referring to a mode of using Julia, not to a limitation on the availability of a debugger.  
If someone has a use for a debugger, great. So, I meant REPL as opposed to “I have to start an IDE and step through the thing line-by-line in order to get anywhere”.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [July 25, 2020, 5:16pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/26 "2020-07-25T17:16:17Z")

</div>

And I mean to say that I don’t see how a REPL decreases the need for a debugger. I’m always used to using them in tandem.

---

<div class="post-metadata">

**Author:** ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Post date:** [July 25, 2020, 5:18pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/27 "2020-07-25T17:18:57Z")

</div>

I came from MATLAB and the debugging there is really fast. What is principle difference between interpreters of MATLAB/PYTHON and Julia?

---

<div class="post-metadata">

**Author:** ![tue](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@tue](https://discourse.julialang.org/u/tue)\
**Post date:** [July 25, 2020, 5:19pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/28 "2020-07-25T17:19:31Z")

</div>

I’m not very familiar with the inner workings of Julia compared to other languages. Are there any languages similar to Julia that have managed to get a debugger working flawlessly?

Secondly, I realize how my post might come across as being very negative of the current debugger, and I just want to thank you, and acknowledge the amazing work you guys put into the debugger.

---

<div class="post-metadata">

**Author:** ![tue](https://avatars.discourse-cdn.com/v4/letter/t/4491bb/32.png) [@tue](https://discourse.julialang.org/u/tue)\
**Post date:** [July 25, 2020, 5:27pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/29 "2020-07-25T17:27:09Z")

</div>

> Also, debuggers can be used for exploring codebases. It’s extremely useful, and I don’t frankly understand how it’s possible to understand code without stepping through it.

I just want to vouch for this as well, especially in machine learning where everyone basically clones each others code and work from there.  
As a specific example I was testing out CycleGAN last year, because we wanted to do something similar with a reversible hyperbolic network. Within 20 minutes I had run their code and stepped all the way through it and had a basic understanding of how it worked, and 1 hour later I had merged our network into their code and were transforming horses to zebras with our network.  
I dread to think how that would have gone without a debugger, and I don’t see REPL being much help in a situation like that.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [July 25, 2020, 5:37pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/30 "2020-07-25T17:37:22Z")

</div>

Running Julia in the debugger is about the same speed as running Matlab or Python is all the time — ie 10-100x slower than Julia normally is. They’re implemented in the same way, using an interpreter. So if you’re happy with the speed of Matlab/Python then you should be fine with Julia’s debugger.

---

<div class="post-metadata">

**Author:** ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Post date:** [July 25, 2020, 5:45pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/31 "2020-07-25T17:45:08Z")

</div>

Well, I tried debugger in Atom and VS Code and both are very slow. MATLAB debugging is simply much faster.

Not sure, where is a bottleneck?

---

<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:** [July 25, 2020, 5:48pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/32 "2020-07-25T17:48:20Z")

</div>

There can be a _much_ bigger overhead for code that’s sensitive to certain compiler optimizations:

```julia
julia> x = rand(100);

julia> f(x) = sum(x)
f (generic function with 1 method)

julia> @btime f(x)
  28.302 ns (1 allocation: 16 bytes)
50.057362567545745

julia> @btime @interpret f(x)
  4.612 ms (30859 allocations: 1.15 MiB)
50.05736256754573

```

Running in “compiled mode” recovers a lot of that performance, but also disables breakpoints in functions further down the callstack:

```julia
julia> function interpret_compiled(f, args...; kwargs...)
         frame = JuliaInterpreter.enter_call(f, args...; kwargs...)
         return JuliaInterpreter.finish_and_return!(JuliaInterpreter.Compiled(), frame)
       end
interpret_compiled (generic function with 1 method)

julia> @btime interpret_compiled(f, x)
  7.373 μs (86 allocations: 5.56 KiB)
50.057362567545745

```

The probably best short-term solution is a mixed-mode debugger that combines Infiltrator and JuliaInterpreter; the long term solution would be reviving Gallium.jl.

---

<div class="post-metadata">

**Author:** ![Zach\_Christensen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zach_christensen/32/7220_2.png) [@Zach\_Christensen](https://discourse.julialang.org/u/Zach_Christensen)\
**Post date:** [July 25, 2020, 5:57pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/33 "2020-07-25T17:57:54Z")

</div>

Sorry if this has been covered already, but debugger in REPL is quite nice. I can find exactly where something is happening by file and line. The only exception to this is when I occasionally get deep into some code that can only show me the compiled code (which is typically still pretty manageable).

As for performance, I ditched Atom before I even knew about Julia because everything slowed it down. VSCode is less sensitive to that but you can still end up adding so many extensions that you slow it down if you’re not careful. I find the first time running `@enter` on something has a bit of a wait but besides that I’ve got nothing to complain about.

I’ve never cared for big fancy debuggers GUI debuggers though so if that’s what you’re after I can’t help you.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [July 25, 2020, 6:17pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/34 "2020-07-25T18:17:00Z")

</div>

What I was trying to explain is that your Matlab code is _always_ as slow as Julia code in the debugger. Matlab only has one speed—slow. Slow normally, slow in the debugger. But the debugger is just as fast as the normal speed, so win? Julia, on the other hand, normally runs at hyperspeed, but can’t in the debugger. So it “feels” too slow when you debug it, but that’s just because it’s much faster normally. So if you wrote the same code in Matlab and Julia and it was fast enough in Matlab, then it would also be fast enough in Julia’s debugger. If you have code that’s too slow in Julia’s debugger then it would also be too slow in Matlab no matter how you run it, debugger or not.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [July 25, 2020, 6:35pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/35 "2020-07-25T18:35:26Z")

</div>

> [@StefanKarpinski](#):
>
> Running Julia in the debugger is about the same speed as running Matlab or Python is all the time — ie 10-100x slower than Julia normally is.

I think it would be fair to say that Matlab is between 1-100x slower than Julia (very approximately) depending on many things.

Matlab’s debugger is probably comparable to a ‘mixed mode’ debugger in Julia. The interpreted code is slow like ordinary Matlab code (except the chunks that are jit’ed), but Matlab also calls out to Fortran/C _a lot_, its so-called ‘built-in’ functions, and _that_ code is _not_ slow. Also, you cannot step into those functions.

---

<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:** [July 25, 2020, 6:41pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/36 "2020-07-25T18:41:02Z")

</div>

Btw, that approach is also somewhat feasible with the current JuliaInterpreter – you can e.g. exclude `Base` from being interpreted:

```julia
julia> push!(JuliaInterpreter.compiled_modules, Base);

julia> @btime @interpret f(x)
  12.201 μs (98 allocations: 6.03 KiB)
49.62499829212982

```

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [July 25, 2020, 6:41pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/37 "2020-07-25T18:41:03Z")

</div>

That’s fair. And Julia calls to C or Fortran libraries are also fast but there are a lot fewer of them in Julia since most functionality is pure Julia. Automatically switching to compiled mode for built-in functions would be a good direction for someone to explore.

---

<div class="post-metadata">

**Author:** ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Post date:** [July 25, 2020, 7:05pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/38 "2020-07-25T19:05:48Z")

</div>

I can not agree. Usually, I rewrite MATLAB code to Julia and still the debugging the MATLAB code is much faster.

I believe that excluding Base and other “external” packages from being interpreted and leaving only my own functions will be the best way.

---

<div class="post-metadata">

**Author:** ![antoine-levitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoine-levitt/32/4008_2.png) [@antoine-levitt](https://discourse.julialang.org/u/antoine-levitt)\
**Post date:** [July 25, 2020, 7:29pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/39 "2020-07-25T19:29:07Z")

</div>

That looks like a very nice solution! Worth a mention in the docs. Does that give up control flow completely? Eg will `sum(f, x)` break on a breakpoint in f?

---

<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:** [July 25, 2020, 7:35pm UTC](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638/40 "2020-07-25T19:35:34Z")

</div>

Yeah, that’s the big problem:

```julia
julia> g(x) = 2x
g (generic function with 1 method)

julia> @breakpoint g(2)
g(x) in Main at REPL[42]:1

julia> @interpret sum(g, x)
(Frame for sum(f, a::AbstractArray; dims) in Base at reducedim.jl:653
  1 653 1 ─ nothing
  2 653 │ %2 = (Base.#sum#584)(Colon(), #self#, f, a)
  3 653 └── return %2
f = g
a = [0.929103, 0.117293, 0.193176, 0.706207, 0.198638, 0.88355, 0.454533, 0.714572, 0.775677, 0.230185 … 0.456054, 0.114394, 0.496087, 0.295862, 0.215286, 0.269377, 0.684313, 0.903918, 0.0682543, 0.798796]
callee: #sum#584(dims, ::typeof(sum), f, a::AbstractArray) in Base at reducedim.jl:653, breakpoint(g(x) in Main at REPL[42]:1, line 1))

julia> push!(JuliaInterpreter.compiled_modules, Base);

julia> @interpret sum(g, x)
99.24999658425963

```

[Previous page](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638.md?page=1)

[Next page](https://discourse.julialang.org/t/debugger-status-and-future-plans/43638.md?page=3)
