diff --git a/src/commands.jl b/src/commands.jl index 4960f373..2698aa81 100644 --- a/src/commands.jl +++ b/src/commands.jl @@ -275,12 +275,20 @@ function maybe_step_through_kwprep!(@nospecialize(recurse), frame::Frame, istopl # We deliberately check isexpr(stmt, :call) rather than is_call(stmt): if it's # assigned to a local, it's *not* kwarg preparation. if isexpr(stmt1, :call) && is_quotenode(stmt1.args[1], Core.apply_type) && is_quoted_type(stmt1.args[2], :NamedTuple) - stmt4 = src.code[pc+4] + stmt4, stmt5 = src.code[pc+4], src.code[pc+5] if isexpr(stmt4, :call) && is_quotenode(stmt4.args[1], Core.kwfunc) while pc < pccall pc = step_expr!(recurse, frame, istoplevel) end return frame + elseif isexpr(stmt5, :call) && is_quotenode(stmt5.args[1], Core.kwfunc) && pccall+1 <= n + # This happens when the call is scoped by a module + pccall += 1 + while pc < pccall + pc = step_expr!(recurse, frame, istoplevel) + end + maybe_next_call!(recurse, frame, istoplevel) + return frame end end end diff --git a/test/debug.jl b/test/debug.jl index 835a5ed0..d6840f53 100644 --- a/test/debug.jl +++ b/test/debug.jl @@ -370,6 +370,11 @@ struct B{T} end frame = stepkw!(frame) @test frame.pc == JuliaInterpreter.nstatements(frame.framecode) - 1 + scopedreversesort(x) = Base.sort(x, rev=true) # https://github.com/JuliaDebug/Debugger.jl/issues/141 + frame = JuliaInterpreter.enter_call(scopedreversesort, a) + frame = stepkw!(frame) + @test frame.pc == JuliaInterpreter.nstatements(frame.framecode) - 1 + frame = JuliaInterpreter.enter_call(sort, a) frame = stepkw!(frame) @test frame.pc == JuliaInterpreter.nstatements(frame.framecode) - 1