# Debugging workflows

**URL:** <https://discourse.julialang.org/t/debugging-workflows/39487>\
**Category:** General Usage\
**Tags:** question, debugging\
**Created:** [May 14, 2020, 7:03pm UTC](https://discourse.julialang.org/t/debugging-workflows/39487 "2020-05-14T19:03:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElectronicTeaCup](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/electronicteacup/32/12647_2.png) [@ElectronicTeaCup](https://discourse.julialang.org/u/ElectronicTeaCup)\
**Post date:** [May 14, 2020, 7:03pm UTC](https://discourse.julialang.org/t/debugging-workflows/39487/1 "2020-05-14T19:03:12Z")

</div>

I am unsure how to ask this but here goes: I am having difficulty debugging my code. Coming from a MATLAB background, I am used to a very smooth debugging experience. But with Julia, I’ve tried using the Juno debugger and it’s very slow. So mostly I end up copy pasting functions in a new file, removing the top and bottom lines (`function x(a,b)` and the `end` statement) and then set inputs manually and go line by line until I get to the point that needs to be debugged. Checking loops with print statements, etc. Ultimately I paste the correct code into my module/package and restart Julia and test it.

It gets the job done but **very messy** , and I feel there must be better ways of debugging. Am I just doing it wrong? What are some good debugging workflows?

---

<div class="post-metadata">

**Author:** ![Iulian.Cioarca](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iulian.cioarca/32/30166_2.png) [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Post date:** [May 14, 2020, 7:20pm UTC](https://discourse.julialang.org/t/debugging-workflows/39487/2 "2020-05-14T19:20:47Z")

</div>

Did you use the `compiled mode` checkbox? I use it all the time and it’s pretty fast. Of course, in compiled mode breakpoints work only in the current function, and I do a lot of `next line` and `step in`, but I got used to it. You can also switch between `compiled` and `interpreted` if you want to set a breakpoint somewhere deep in the code, but you need to be a bit more patient with the interpreter until it gets there.  
The only situation where debugging is slow for me is when I debug the backpropagation pass in Knet on a gpu.  
Edit: in compiled mode you might have the impression that things are a bit slow if you’re debugging a function first time because it’s also compiling it. In these situations I look at the progress bar in Juno at the bottom left and wait for it to finish. Sometimes it doesn’t show up until I click somewhere in the file I’m debugging.  
Another quirk of Juno is that it always starts the debugger in interpreted mode, so you have to exit debugging, click the checkbox and enter again. You will see the REPL in blue instead of yellow and know you’re in compiled mode.

---

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [May 14, 2020, 8:18pm UTC](https://discourse.julialang.org/t/debugging-workflows/39487/3 "2020-05-14T20:18:44Z")

</div>

Yes, Juno debugging is powerful, but the UI sometimes overwhelms me too.

---

<div class="post-metadata">

**Author:** ![ElectronicTeaCup](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/electronicteacup/32/12647_2.png) [@ElectronicTeaCup](https://discourse.julialang.org/u/ElectronicTeaCup)\
**Post date:** [May 15, 2020, 12:43pm UTC](https://discourse.julialang.org/t/debugging-workflows/39487/4 "2020-05-15T12:43:53Z")

</div>

I know about it, but it caused me trouble at some time (can’t recall what exactly) and I didn’t try it again. Okay, thank you—I’ll give it another go. I just wanted to do a sanity check in case most people were using a different means of debugging in general or using print statements etc.

---

<div class="post-metadata">

**Author:** ![clarkfitzg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/clarkfitzg/32/15373_2.png) [@clarkfitzg](https://discourse.julialang.org/u/clarkfitzg)\
**Post date:** [June 24, 2020, 12:33am UTC](https://discourse.julialang.org/t/debugging-workflows/39487/5 "2020-06-24T00:33:48Z")

</div>

You might try the Debugger package. I wrote up a [brief intro](http://clarkfitzg.github.io/2020/06/19/intro-to-Julia's-Debugger/).

---

<div class="post-metadata">

**Author:** ![clarkfitzg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/clarkfitzg/32/15373_2.png) [@clarkfitzg](https://discourse.julialang.org/u/clarkfitzg)\
**Post date:** [July 20, 2020, 11:14pm UTC](https://discourse.julialang.org/t/debugging-workflows/39487/6 "2020-07-20T23:14:14Z")

</div>

Updated URL: [Introduction to Julia’s Debugger - Clark Fitzgerald](http://webpages.csus.edu/fitzgerald/julia-debugger-tutorial/)

---

<div class="post-metadata">

**Author:** ![alejandromerchan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alejandromerchan/32/10500_2.png) [@alejandromerchan](https://discourse.julialang.org/u/alejandromerchan)\
**Post date:** [July 20, 2020, 11:48pm UTC](https://discourse.julialang.org/t/debugging-workflows/39487/7 "2020-07-20T23:48:11Z")

</div>

Thanks for this, it’s great. I’m not a programmer and debuggers always seemed a little to daunting for me, but I needed something like this tutorial for Julia.
