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

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

1 Like

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.

I’m experiencing both your issues.

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

1 Like

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

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

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?

Have you followed these instructions?
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.

2 Likes

My startup config looks like this:

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.

@async Revise.wait_steal_repl_backend()

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

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
´´´