JuliaDebug / Gallium.jl

The Julia debugger
Other
174 stars 23 forks source link

can't debug functions using keyword arguments #128

Closed Ken-B closed 8 years ago

Ken-B commented 8 years ago

Calling a function with a keyword argument fails:

julia> f(x; a=2) = a*x
f (generic function with 1 method)

julia> @enter f(1; a = 5)
ERROR: syntax: unhandled expr (parameters (kw a 5))
 in eval(::Module, ::Any) at ./boot.jl:231
 in macro expansion at ./REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:46

Actually, also when calling without a keyword argument there's some issue:

julia> breakpoint(f)
Locations (+: active, -: inactive, *: source):
 * Any matching method added to #f
 * Any matching specialization of f(x) at REPL[2]:1

julia> f(1)
In REPL[2]:1
1 f(x; a=2) = a*x

About to run: Main.#f#1
1|debug > n
ERROR: local variable #self# not defined
 in _step_expr(::ASTInterpreter.Interpreter) at /Users/ken/.julia/v0.5/ASTInterpreter/src/ASTInterpreter.jl:575
 in #next_line!#34(::ASTInterpreter.InterpreterState, ::Function, ::ASTInterpreter.Interpreter) at /Users/ken/.julia/v0.5/ASTInterpreter/src/ASTInterpreter.jl:750
 in (::ASTInterpreter.#kw##next_line!)(::Array{Any,1}, ::ASTInterpreter.#next_line!, ::ASTInterpreter.Interpreter) at ./null:0
 in execute_command(::ASTInterpreter.InterpreterState, ::ASTInterpreter.Interpreter, ::Val{:n}, ::String) at /Users/ken/.julia/v0.5/ASTInterpreter/src/ASTInterpreter.jl:1465
 in (::ASTInterpreter.##61#67{ASTInterpreter.Interpreter,ASTInterpreter.#promptname#65,ASTInterpreter.InterpreterState,Base.LineEdit.Prompt,Base.LineEdit.Prompt})(::Base.LineEdit.MIState, ::Base.AbstractIOBuffer{Array{UInt8,1}}, ::Bool) at /Users/ken/.julia/v0.5/ASTInterpreter/src/ASTInterpreter.jl:1566
 in run_interface(::Base.Terminals.TTYTerminal, ::Base.LineEdit.ModalInterface) at ./LineEdit.jl:1570
 in RunDebugREPL(::ASTInterpreter.Interpreter) at /Users/ken/.julia/v0.5/ASTInterpreter/src/ASTInterpreter.jl:1644
 in (::Gallium.##98#100)(::Int64) at ./null:0
 in eval(::Module, ::Any) at ./boot.jl:231
 in macro expansion at ./REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:46
Ken-B commented 8 years ago

Thanks for the quick fix!