Skip to content

Commit 8758ba9

Browse files
authored
fix assertion when breakpoint triggers during wrapper step through (#225)
* fix when breakpoint happens during wrapper step through * Update test/debug.jl Co-Authored-By: KristofferC <[email protected]>
1 parent 841423c commit 8758ba9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/commands.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ function maybe_step_through_wrapper!(@nospecialize(recurse), frame::Frame)
244244
# this is a wrapper function that we might want to step through
245245
while frame.pc != length(stmts)-1
246246
pc = next_call!(recurse, frame, false) # since we're in a Method we're not at toplevel
247-
pc === nothing && return frame
247+
if pc === nothing || isa(pc, BreakpointRef)
248+
return frame
249+
end
248250
end
249251
ret = evaluate_call!(dummy_breakpoint, frame, last)
250252
@assert isa(ret, BreakpointRef)

test/debug.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,14 @@ struct B{T} end
425425
@test frame.pc == 1
426426
end
427427

428+
@testset "breakpoints hit during wrapper step through" begin
429+
f(x = g()) = x
430+
g() = 5
431+
@breakpoint g()
432+
frame = JuliaInterpreter.enter_call(f)
433+
JuliaInterpreter.maybe_step_through_wrapper!(frame)
434+
@test leaf(frame).framecode.scope == @which g()
435+
end
428436

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

0 commit comments

Comments
 (0)