Debugger.jl, @bp does not work

I get an error when I try to debug a Julia file from REPL as follows.
The source file main.jl

# main.jl
using Debugger
function my_add(a::Int, b::Int)
     @bp        # want to stop here 
     c = a + b  
     return c

Debug in REPL mode as follows.

> using Debugger
> include("main.jl")
> @run my_add(1, 2)

Hower, Julia does not stop at the break point. The other functions work very well. Do I use @bp in a wrong way?

By the way, Debugger.jl is pretty cool! The output in REPL mode is very clear and beautiful. Congratulations!

This is sort of a bug but will only happen if you have @bp as the very first thing in the very first function you run (and then you might as well do @enter).

For example:

julia> function my_add(a::Int, b::Int)
           @bp        # want to stop here
           c = a + b
           return c
my_add (generic function with 1 method)

julia> f(a, b) = my_add(a, b)
f (generic function with 1 method)

julia> @run f(1, 2)
Hit breakpoint:
In my_add(a, b) at REPL[25]:2
●2      @bp        # want to stop here
>3      c = a + b
 4      return c
 5  end

About to run: (+)(1, 2)

I’ll fix it though.

1 Like

I am working on a big project and there are a lot of Julia files. Thus, it is convenient to set the break point in this way.

@kristoffer.carlsson Thank you so much for your excellent work on Debugger.jl. It must be the biggest news in Julia community after the release of Julia 1.0. Congratulations!

Why not set a breakpoint on my_add then (with breakpoint(my_add))?

It does not stop at the line of @bp. Waiting for the integration of Juno and the debug function. Thanks for your work!

True, will fix that asap. I’d suggest setting normal breakpoints for now using the GUI.


Is there some documentation for the debugger in Juno? I didn’t realize that graphical breakpoints work

Not really, but [ANN] Juno 0.8 provides a short overview over what you can do. I’ll write more comprehensive docs once I find some time and motivation for that…

1 Like

This actually works fine, provided you qualify @bp properly and don’t have it as the first line in your function:

So yeah, this isn’t really a priority.