Skip to content

Commit

Permalink
fix assertion when breakpoint triggers during wrapper step through (#225
Browse files Browse the repository at this point in the history
)

* fix when breakpoint happens during wrapper step through

* Update test/debug.jl

Co-Authored-By: KristofferC <[email protected]>
  • Loading branch information
KristofferC authored Mar 27, 2019
1 parent 841423c commit 8758ba9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/commands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ function maybe_step_through_wrapper!(@nospecialize(recurse), frame::Frame)
# this is a wrapper function that we might want to step through
while frame.pc != length(stmts)-1
pc = next_call!(recurse, frame, false) # since we're in a Method we're not at toplevel
pc === nothing && return frame
if pc === nothing || isa(pc, BreakpointRef)
return frame
end
end
ret = evaluate_call!(dummy_breakpoint, frame, last)
@assert isa(ret, BreakpointRef)
Expand Down
8 changes: 8 additions & 0 deletions test/debug.jl
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,14 @@ struct B{T} end
@test frame.pc == 1
end

@testset "breakpoints hit during wrapper step through" begin
f(x = g()) = x
g() = 5
@breakpoint g()
frame = JuliaInterpreter.enter_call(f)
JuliaInterpreter.maybe_step_through_wrapper!(frame)
@test leaf(frame).framecode.scope == @which g()
end

@testset "preservation of stack when throwing to toplevel" begin
f() = "αβ"[2]
Expand Down

0 comments on commit 8758ba9

Please sign in to comment.