JuliaDebug / Debugger.jl

Julia debugger
MIT License
470 stars 43 forks source link

Error trying to debug callable struct function #321

Closed Suavesito-Olimpiada closed 2 years ago

Suavesito-Olimpiada commented 2 years ago

The MWE that I found is the next

julia> using Debugger

julia> struct Functor end

julia> (::Functor)(x, y) = x+y

julia> f = Functor()
Functor()

julia> f(1, 2)
3

julia> @enter f(1, 2)
ERROR: BoundsError: attempt to access 1-element Vector{Any} at index [2]
Stacktrace:
 [1] getindex
   @ ./array.jl:924 [inlined]
 [2] checkname(fdef::Expr, name::Symbol)
   @ CodeTracking ~/.julia/packages/CodeTracking/rwfOQ/src/utils.jl:8
 [3] isfuncexpr(ex::Expr, name::Symbol)
   @ CodeTracking ~/.julia/packages/CodeTracking/rwfOQ/src/utils.jl:35
 [4] definition(#unused#::Type{String}, method::Method)
   @ CodeTracking ~/.julia/packages/CodeTracking/rwfOQ/src/CodeTracking.jl:234
 [5] locinfo(frame::JuliaInterpreter.Frame)
   @ Debugger ~/.julia/packages/Debugger/APRPi/src/locationinfo.jl:10
 [6] print_status(io::Base.TTY, frame::JuliaInterpreter.Frame; force_lowered::Bool)
   @ Debugger ~/.julia/packages/Debugger/APRPi/src/printing.jl:134
 [7] RunDebugger(frame::JuliaInterpreter.Frame, repl::Nothing, terminal::Nothing; initial_continue::Bool)
   @ Debugger ~/.julia/packages/Debugger/APRPi/src/repl.jl:166
 [8] RunDebugger (repeats 2 times)
   @ ~/.julia/packages/Debugger/APRPi/src/repl.jl:12 [inlined]
 [9] top-level scope
   @ ~/.julia/packages/Debugger/APRPi/src/Debugger.jl:127

Using Julia v1.8.2 official binary and Debugger.jl v0.7.6.

julia> versioninfo()
Julia Version 1.8.2
Commit 36034abf260 (2022-09-29 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 4 on 4 virtual cores
Environment:
  JULIA_NUM_THREADS = 4

(@v1.8) pkg> st Debugger
Status `~/.julia/environments/v1.8/Project.toml`
  [31a5f54b] Debugger v0.7.6
KristofferC commented 2 years ago

Fixed by https://github.com/timholy/CodeTracking.jl/pull/99. New version getting tagged in https://github.com/JuliaRegistries/General/pull/70907.