[ANN] Juno 0.8

Thanks, that’s actually what solved the case for me too.

How to use debugger on Juno

  1. create file myjuliaprog.jl
    make sure there is a function called main() which runs your entire program. Just like the main() in the C language. For debugging purposes, make sure the initial call to main() is commented out otherwise the program will run when you includet it in step 3
  2. start REPL and type
    using Revise
    println(“the above is not necessary if you auto start Revise in your startup.jl”)
  3. on the REPL type
    includet(“myjuliaprog.jl")
    println(“Please note!!! There is a T at the end of the word include”)
  4. on Juno set your breakpoint using mouse cursor on linenumber. You can set as many breakpoints as you want
  5. on REPL type
    Juno.@run main()
    or
    Juno.@enter main() if you want to step through it line by line

Jesus. I wish someone had posted clear and simple instructions like this, instead of me having to find out the hard way through the school of HARD KNOCKS.

9 Likes

Thanks for developing Juno - and for integrating the debugger. It looks very promising.

After having played with this, I have the the following comments & suggestions:

  • The stepping control bar should perhaps be floating in the main window, rather than fixed at the top of the Debugger pane. In general, most of the action should be in the main window.
  • As an alternative to @Juno.enter, please consider an icon in the toolbar and/or a keyboard shortcut.
  • Stepping through a script and now and then stepping into a function should be easy. The current approach with first using Revise.jl and then embedding the script into a main() function is a bit tricky.
1 Like

Did you see the docs linked above? If you feel like they could be improved, please open a PR here.

Thanks for the feedback!

  • Earlier drafts of the UI actually did have the toolbar floating at the top of the current editor, but I’m not entirely sure I like that better.
  • A toolbar button for entering the current expression does seem like a good idea, yes. I also wanted to add a checkbox to run all code in interpreted-mode, so breakpoints would always be respected.
  • Hm, the current situation certainly isn’t ideal, but I feel like most code one would want to debug is in a library/package/whatever. Also note that you don’t need to do anything special if you want to just step through a function (no using Revise, no other shenanigans).
2 Likes

feel like most code one would want to debug is in a library/package/whatever

Perhaps, but I see another use case for the debugger: a scientist (or similar) tries to code up something new. She has a script file and a few other files with her own functions. She wants to step through the script, perhaps jumping over some blocks that she knows work, and then into one of her own functions (in one of those other files), and perhaps also there jump to a specific line.

Making this easier would be very welcome.

2 Likes

But isn’t that already supported? You can step through your top-level script with Ctrl-Enter and then step through a certain function by prefixing it with Juno.@enter (or a dedicated command with the next release)?

1 Like

Jesus. I wish someone had posted clear and simple instructions like this, instead of me having to find out the hard way through the school of HARD KNOCKS.

I hate to say it, but compared to the amount of work we did implementing it and then writing up (obviously imperfect and still-evolving) documentation, your suffering is relatively minor.

30 Likes

You can step through your top-level script

Indeed and that is very useful.

I might have misunderstood something, but it seems more involved to step through a function from an include()d file. I’ve got the impression this takes (1) using Revise.jl; (2) includet(); and then it works (although the breakpoints in such functions must be set by breakpoint()). It would be great if this process could be simplified.

If you don’t need source breakpoints (those set by clicking next to a line number) then you do not need Revise.jl.

In a fresh Juno session you can do

julia> function f(x,y)
         z = x+y
         x*y*z
       end
f (generic function with 1 method)

julia> Juno.@enter f(2,3)
30        

and it just works – same for functions in whatever file you have included. Everything your current Julia session knows about can be stepped into.

3 Likes

Hmm, I have Atom.jl 0.7.4 and Juno.jl 0.5.4, and neither will update. I don’t think I have anything that would require them to be lower versions…

Try add the specific version explicitly, e.g: add Atom@0.8.2 in the Pkg REPL and see what happens.

ERROR: Unsatisfiable requirements detected for package Atom [c52e3926]:
 Atom [c52e3926] log:
 ├─possible versions are: [0.1.0-0.1.1, 0.2.0-0.2.1, 0.3.0, 0.4.0-0.4.6, 0.5.0-0.5.10, 0.6.0-0.6.17, 0.7.0-0.7.14] or uninstalled
 └─restricted to versions 0.8.2 by an explicit requirement — no versions left

Similar for Juno.

Looks like your registries is out of date. Are you running JuliaPro?

You can go into .julia/registries and delete everything there and things should redownload.

4 Likes

I have Julia Pro installed but I’ve been using a base Atom install with uber-julia etc.

Deleting registries content allowed me to update, thanks!

Debugging takes a little setting up, but it’s great! Many thanks to you who made it happen :slight_smile:

Now I am trying to use “includet” on a file but I still get the “restart and load Revise” message when trying to set a graphical breakpoint.

It doesn’t seem to like modules that are not in a package. If I re-load the file without being wrapped in a module, graphical breakpoints work.

Edit: It’s more tricky than that. I have to repeat “includet()” to get it to recognize changes, but that doesn’t help my module file…

Update: Okay, so it appears that including a docstring in front of a module breaks breakpoints within the module.

And you have to keep using includet() to recognize changes in the file for adding breakpoints, they won’t be registered automatically by Revise.jl.

And you have to keep using includet() to recognize changes in the file for adding breakpoints, they won’t be registered automatically by Revise.jl.

In general that should not be necessary, and indeed I know it isn’t in many circumstances. Sounds like a Revise bug for the specific code you’re testing. Please file an issue with a MWE, if possible. Nevermind, it doesn’t seem to be a Revise bug. xref [BUG] Debugger - graphical breakpoints broken when docstring preceeds module · Issue #271 · JunoLab/Juno.jl · GitHub

1 Like

Hmm, I just tested with Rebugger and it all seems to work fine. Using this as a test file:

"""
A docstring
"""
module MyMod

f() = 1

end

I can set breakpoints in f, step in to f, edit f and see the changes take place, etc.

Quick update: Juno 0.8.2 is out, with loads of bugfixes and quality-of-life improvements:

Debugger related

  • Running into an error while Break on Exception is on will now correctly show the error message and print a message when you try to step elsewhere.
  • Juno.@run now correctly handles breakpoints on the first line of a function.
  • You can navigate the callstack by clicking on the level, which allows you to eval code in non-leaf frames.
  • Trying to call Juno.@enter or similar while debugging now fails gracefully.
  • The debug> REPL mode now remembers old commands.
  • The debug toolbar’s tooltips no longer obscure the next-statement line below.
  • The Debugger Pane is now correctly updated when a Julia session is exited. This also fixed an inconsistency with Break on Exception showing the wrong value.
  • The debug> prompt now looks better on Windows (and is consistent with Debugger.jl).

Miscellaneous

15 Likes

I have Juno 0.7.0 and it is not updating. Tried running (v1.2) pkg> add Juno@0.8.2, but I get

ERROR: Unsatisfiable requirements detected for package Juno [e5e0dc1b]:
 Juno [e5e0dc1b] log:
 ├─possible versions are: [0.1.0, 0.2.0-0.2.7, 0.3.0-0.3.2, 0.4.0-0.4.1, 0.5.0-0.5.5, 0.6.0, 0.7.0] or uninstalled
 └─restricted to versions 0.8.2 by an explicit requirement — no versions left

I did try deleting .julia/registries as suggested by @kristoffer.carlsson, but it did not help.
I’m not running Juno Pro.

Any ideas on how to resolve this?