# Debugging with Juno (multiple restarts necessary to make code changes debuggable)

**URL:** <https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427>\
**Category:** General Usage\
**Created:** [May 21, 2019, 12:09pm UTC](https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427 "2019-05-21T12:09:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Volker](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volker](https://discourse.julialang.org/u/Volker)\
**Post date:** [May 21, 2019, 12:09pm UTC](https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427/1 "2019-05-21T12:09:34Z")

</div>

Hello,

I use Julia v1.1, Atom 1.37.0 x64, Juno 0.8.3. under Windows 10. Sometimes when try to debug my code Juno doesn´t recognize my code or the code changes I have made. So that I have to restart Julia relatively often.

Does somebody else has this problem? Or is it a known problem?

For debugging I use the command Juno@run myfunc() or Juno@enter myfunc() with the packages Debugger, Rebugger, Revise and JulianInterpreter and the includet command for the files, where I would like to set breakpoints.

Do I miss something for the right handling of the debugger?

Best regards,  
Volker

---

<div class="post-metadata">

**Author:** ![Volker](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volker](https://discourse.julialang.org/u/Volker)\
**Post date:** [May 21, 2019, 1:14pm UTC](https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427/2 "2019-05-21T13:14:04Z")

</div>

Furthermore sometimes when I type in a variable name in the command prompt in debug mode, which is already created and listed in the workspace, I get an UndefVarError message. Then I tried to go ahead with debug next line and the code, which is depending on the same variable, is evaluated.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [May 21, 2019, 1:49pm UTC](https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427/3 "2019-05-21T13:49:16Z")

</div>

I’m experiencing both your issues.

For your second issue, see here  
[https://github.com/JunoLab/Juno.jl/issues/287](https://github.com/JunoLab/Juno.jl/issues/287)

---

<div class="post-metadata">

**Author:** ![Volker](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volker](https://discourse.julialang.org/u/Volker)\
**Post date:** [May 21, 2019, 1:58pm UTC](https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427/4 "2019-05-21T13:58:52Z")

</div>

Thanks. This is very helpful. This solves at least the problem with the command prompt.

---

<div class="post-metadata">

**Author:** ![Volker](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volker](https://discourse.julialang.org/u/Volker)\
**Post date:** [May 22, 2019, 8:59am UTC](https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427/5 "2019-05-22T08:59:25Z")

</div>

Do you know something about the first issue? In example if it will be fixed in the next couple month?

---

<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:** [May 22, 2019, 9:22am UTC](https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427/6 "2019-05-22T09:22:48Z")

</div>

> [@Volker](#):
>
> Sometimes when try to debug my code Juno doesn´t recognize my code or the code changes I have made. So that I have to restart Julia relatively often.

This is a bit vague – did you re-eval the code in the right module? Or did you rely on Revise? If the latter, did you make sure that Revise knows about the module/file you’ve loaded?

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [May 22, 2019, 11:04am UTC](https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427/7 "2019-05-22T11:04:25Z")

</div>

Have you followed these instructions?  
[https://timholy.github.io/Revise.jl/dev/config/](https://timholy.github.io/Revise.jl/dev/config/)

Hint: a situation where I detected that the cited configuration does not work is when you have set the environment variable JULIA\_DEPOT\_PATH to a place different from the default directory. In such case, if your packages live in “xxxx/.julia”, then it seems that “xxxx/.julia/config/” is not the place where the “startup.jl” is looked for. Editing “etc/julia/startup.jl” in your Julia installation directory works though.

---

<div class="post-metadata">

**Author:** ![Volker](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volker](https://discourse.julialang.org/u/Volker)\
**Post date:** [May 22, 2019, 11:56am UTC](https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427/8 "2019-05-22T11:56:34Z")

</div>

My startup config looks like this:

```julia
user = "Volker"
lib_path = string("C:/Users/", user, "/Data/Ju_Lib/")
root_test = [root for (root, dirs, files) in walkdir(lib_path)]
dirs_test = [dirs for (root, dirs, files) in walkdir(lib_path)]
lib_paths = []
for i in 1:length(dirs_test), j in 1:length(dirs_test[i])
    if ~isempty(dirs_test[i])
        push!(LOAD_PATH, (replace(string(root_test[i], "/", dirs_test[i][j]), "//" => "/")))
    end
end

using Debugger
using Rebugger
using JuliaInterpreter
using Revise

includet(string(lib_path, "eaopt/Individual.jl")
includet(string(lib_path, "eaopt/Population.jl")

using Population
using Individual

```

I add the paths of all my folders in directory C:/Users/", user, "/Data/Ju\_Lib/ the LOAD\_PATH, so that the using command finds my moduls. I don´t know if this could be the mistake.

Maybe the following command will fix this. I will reply my progress.

```julia
@async Revise.wait_steal_repl_backend()

```

---

<div class="post-metadata">

**Author:** ![Volker](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volker](https://discourse.julialang.org/u/Volker)\
**Post date:** [May 27, 2019, 10:25am UTC](https://discourse.julialang.org/t/debugging-with-juno-multiple-restarts-necessary-to-make-code-changes-debuggable/24427/9 "2019-05-27T10:25:48Z")

</div>

The configuration helps, so that the module will be recompiled after restart Julia. I add the following code to my startup.

```julia
using Debugger
using Rebugger
using JuliaInterpreter

ENV["JULIA_REVISE"] = "auto"
ENV["JULIA_REVISE_INCLUDE"] = 1

atreplinit() do repl
    try
        @eval using Revise
        @async Revise.wait_steal_repl_backend()
    catch
    end
end
´´´
```
