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

Breakpoint skipped when set on function

Open fredrikekre opened this issue 4 years ago • 1 comments

Likely related to keyword arguments. Did not manage to find a MWE just yet, but this should reproduce it:

$ pkg st
      Status `/tmp/tmp.NYFUEV6YuR/Project.toml`
  [31a5f54b] Debugger v0.6.8
  [98b081ad] Literate v2.9.3

$ julia -q
julia> write("test.jl", "hello");

julia> using Debugger, Literate

julia> @enter Literate.markdown("test.jl")
In #markdown#27(config, kwargs, , inputfile, outputdir) at /home/fredrik/.julia/packages/Literate/3Mk7t/src/Literate.jl:488
 488  function markdown(inputfile, outputdir=pwd(); config::Dict=Dict(), kwargs...)
 489      # preprocessing and parsing
>490      chunks, config =
 491          preprocessor(inputfile, outputdir; user_config=config, user_kwargs=kwargs, type=:md)
 492  
 493      # create the markdown file
 494      sb = sandbox()

About to run: (Core.apply_type)(NamedTuple, (:user_config, :user_kwargs, :type))
1|debug> bp add Literate.preprocessor
[ Info: added breakpoint for function preprocessor
1] preprocessor

1|debug> c
[ Info: generating markdown page from `/tmp/tmp.NYFUEV6YuR/test.jl`
[ Info: writing result to `/tmp/tmp.NYFUEV6YuR/test.md`
"/tmp/tmp.NYFUEV6YuR/test.md"

julia>

fredrikekre avatar Oct 18 '21 14:10 fredrikekre

Okay, here is a smaller example:

julia> function f(a; b=1)
           @info "in f"
       end
f (generic function with 1 method)

julia> function g()
           x = 1
           y = f(x, b=x)
           return y
       end
g (generic function with 1 method)

julia> using Debugger

julia> @enter g()
In g() at REPL[2]:1
 1  function g()
 2      x = 1
>3      y = f(x, b=x)
 4      return y
 5  end

About to run: (Core.apply_type)(NamedTuple, (:b,))
1|debug> bp add f
[ Info: added breakpoint for function f
1] f

1|debug> c
[ Info: in f

julia>

with

$ pkg st -m 
      Status `/tmp/tmp.NYFUEV6YuR/Manifest.toml`
  [da1fd8a2] CodeTracking v1.0.6
  [a8cc5b0e] Crayons v4.0.4
  [31a5f54b] Debugger v0.6.8
  [ffbed154] DocStringExtensions v0.8.5
  [eafb193a] Highlights v0.4.5
  [aa1ae85d] JuliaInterpreter v0.8.21

fredrikekre avatar Oct 18 '21 14:10 fredrikekre

This have been fixed.

1|debug> bp add f
[ Info: added breakpoint for function f
1] f

1|debug> c
Hit breakpoint:
In f##kw(, , a) at REPL[3]:1
>1  function f(a; b=1)
 2      @info "in f"
 3  end

KristofferC avatar Sep 16 '22 10:09 KristofferC