Debugger.jl icon indicating copy to clipboard operation
Debugger.jl copied to clipboard

don't step over breakpoint on first statement

Open pfitzseb opened this issue 6 years ago • 3 comments

Fixes https://github.com/JuliaDebug/Debugger.jl/issues/134.

pfitzseb avatar Mar 29 '19 12:03 pfitzseb

Codecov Report

Merging #148 into master will increase coverage by 0.04%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #148      +/-   ##
==========================================
+ Coverage   80.59%   80.63%   +0.04%     
==========================================
  Files           7        7              
  Lines         474      475       +1     
==========================================
+ Hits          382      383       +1     
  Misses         92       92
Impacted Files Coverage Δ
src/repl.jl 77.04% <100%> (ø) :arrow_up:
src/Debugger.jl 91.3% <100%> (+0.39%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f8720a9...23c0964. Read the comment docs.

codecov-io avatar Mar 29 '19 12:03 codecov-io

Will this work even if we step through a wrapper function with a breakpoint?

KristofferC avatar Mar 29 '19 16:03 KristofferC

You mean for something like

julia> f(x; y=3) = x+y
f (generic function with 1 method)

julia> @breakpoint f(2, y=3)
breakpoint((::getfield(Main, Symbol("#kw##f")))(::Any, ::typeof(f), x) in Main, line 0)

julia> @run f(2,y=3)
5

? No. We could use

    quote
        theargs = $(esc(args))
        frame = JuliaInterpreter.enter_call_expr(Expr(:call,theargs...))
        if frame ≠ nothing && !JuliaInterpreter.shouldbreak(frame, frame.pc)
            frame = JuliaInterpreter.maybe_step_through_kwprep!(frame)
            if frame ≠ nothing && !JuliaInterpreter.shouldbreak(frame, frame.pc)
                frame = JuliaInterpreter.maybe_step_through_wrapper!(frame)
                if frame ≠ nothing && !JuliaInterpreter.shouldbreak(frame, frame.pc)
                    JuliaInterpreter.maybe_next_call!(frame)
                end
            end
        end
        frame
    end

for that to work though, although I'd kinda argue that the breakpoint shouldn't be set in the wrapper at all. Alternatively we could maybe handle this on the JuliaInterpreter side somewhat like this.

pfitzseb avatar Mar 29 '19 16:03 pfitzseb