JuliaDebug / Cthulhu.jl

The slow descent into madness
MIT License
650 stars 41 forks source link

at-descend errors about not being able to find source #350

Open quinnj opened 1 year ago

quinnj commented 1 year ago

Full stacktrace:

ERROR: couldn't find the source; inspect `Main.interp` and `Main.mi`
Stacktrace:
  [1] error
    @ ./error.jl:35
  [2] lookup_optimized(interp::Cthulhu.CthulhuInterpreter, mi::Core.MethodInstance, allow_no_src::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:325
  [3] #lookup#83
    @ ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:298 [inlined]
  [4] lookup(interp::Cthulhu.CthulhuInterpreter, mi::Core.MethodInstance, optimize::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:296
  [5] lookup_constproped_optimized(interp::Cthulhu.CthulhuInterpreter, override::Core.Compiler.InferenceResult)
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:366
  [6] lookup_constproped(interp::Cthulhu.CthulhuInterpreter, override::Core.Compiler.InferenceResult, optimize::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:345
  [7] lookup_constproped(interp::Cthulhu.CthulhuInterpreter, #unused#::Cthulhu.CthulhuCursor, override::Core.Compiler.InferenceResult, optimize::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/interface.jl:28
  [8] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, curs::Cthulhu.CthulhuCursor; override::Core.Compiler.InferenceResult, debuginfo::Cthulhu.DInfo.DebugInfo, optimize::Bool, interruptexc::Bool, iswarn::Bool, hide_type_stable::Bool, verbose::Nothing, remarks::Bool, with_effects::Bool, inline_cost::Bool, type_annotations::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:452
  [9] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, curs::Cthulhu.CthulhuCursor; override::Core.Compiler.InferenceResult, debuginfo::Cthulhu.DInfo.DebugInfo, optimize::Bool, interruptexc::Bool, iswarn::Bool, hide_type_stable::Bool, verbose::Nothing, remarks::Bool, with_effects::Bool, inline_cost::Bool, type_annotations::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:600
 [10] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, curs::Cthulhu.CthulhuCursor; override::Nothing, debuginfo::Cthulhu.DInfo.DebugInfo, optimize::Bool, interruptexc::Bool, iswarn::Bool, hide_type_stable::Bool, verbose::Nothing, remarks::Bool, with_effects::Bool, inline_cost::Bool, type_annotations::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:600
 [11] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, curs::Cthulhu.CthulhuCursor; override::Nothing, debuginfo::Symbol, optimize::Bool, interruptexc::Bool, iswarn::Bool, hide_type_stable::Bool, verbose::Nothing, remarks::Bool, with_effects::Bool, inline_cost::Bool, type_annotations::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:600
 [12] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, mi::Core.MethodInstance; kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:iswarn,), Tuple{Bool}}})
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:731
 [13] _descend(term::REPL.Terminals.TTYTerminal, args::Any; interp::Core.Compiler.NativeInterpreter, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:iswarn,), Tuple{Bool}}})
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:747
 [14] __descend_with_error_handling(args::Any; terminal::Any, kwargs::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:234
 [15] _descend_with_error_handling(f::Any, argtypes::Any; kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:iswarn,), Tuple{Bool}}})
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:223
 [16] descend_code_typed(::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:168
 [17] descend_code_typed(::Any, ::Any)
    @ Cthulhu ~/.julia/packages/Cthulhu/rzRYl/src/Cthulhu.jl:168
 [18] top-level scope
    @ REPL[6]:1

I can share the values of Main.interp and Main.mi if those are helpful, but the output is quite large for interp, so I won't include it by default.

I'm on macOS, pretty recent master:

julia> VERSION
v"1.10.0-DEV.610"

This issue can be reproduced by cloning https://github.com/quinnj/JSONBase.jl/tree/jq-cthulhu-error and then running:

using JSONBase, Cthulhu
struct A
    a::Int
    b::Int
    c::Int
    d::Int
end
@descend JSONBase.materialize("""{ "a": 1,"b": 2,"c": 3,"d": 4}""", A)

and then descending into 1) the only option, 2) • %872 = < constprop > _materialize(::ValFuncClosure{…},::LazyValue{…},::Type{…},::Type{…})::Int64, then 3) the only option.

timholy commented 1 year ago

Thanks for the report!

aviatesk commented 1 year ago

359 is unrelated to this issue, and we should keep this open.

timholy commented 1 year ago

Oh, duh, I think I was looking at a different stack trace in a different window and mixed the two up! Still, this proved to be a useful case for TypedSyntax!