oxinabox / MagneticReadHead.jl

A cassette-based debugger | The Other Debugger
MIT License
50 stars 6 forks source link

REPL functions crash the debugger #28

Closed KristofferC closed 5 years ago

KristofferC commented 5 years ago
julia> function f(x)
           return x
       end
f (generic function with 1 method)

julia> set_breakpoint!(f)
2-element Array{MagneticReadHead.Rule,1}:
 MagneticReadHead.Rule{typeof(f)}(f, 0)
 MagneticReadHead.Rule{typeof(f)}(f, 0)

julia> @iron_debug f(2)

Breakpoint Hit: f(x) in Main at REPL[2]:2ERROR: SystemError: opening file "REPL[2]": No such file or directory
Stacktrace:
 [1] #systemerror#43(::Nothing, ::Function, ::String, ::Bool) at ./error.jl:134
 [2] systemerror at ./error.jl:134 [inlined]
 [3] #open#309(::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Function, ::String) at ./iostream.jl:283
 [4] open at ./iostream.jl:275 [inlined]
 [5] #open#310(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(Base, Symbol("##286#287")){Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}}, ::String) at ./iostream.jl:367
 [6] open at ./iostream.jl:367 [inlined]
 [7] #readlines#285 at ./io.jl:410 [inlined]
StefanKarpinski commented 5 years ago

Maybe make the file for REPL input the history file instead?

oxinabox commented 5 years ago

That, or perhaps use CodeTracking.jl's definition function.

I'll need to work out how REPL methods calculate there lineinfo.

KristofferC commented 5 years ago

Steal this: https://github.com/JuliaDebug/Debugger.jl/blob/master/src/locationinfo.jl#L23-L28