Skip to content

Commit 50fe1a8

Browse files
authored
fix next_until! not properly returning breakpoint refs (#270)
1 parent 5a6f71b commit 50fe1a8

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/commands.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,8 @@ evaluation terminates, `nothing` (if the frame reached a `return`), or a `Breakp
9292
function next_until!(@nospecialize(predicate), @nospecialize(recurse), frame::Frame, istoplevel::Bool=false)
9393
pc = step_expr!(recurse, frame, istoplevel)
9494
while pc !== nothing && !isa(pc, BreakpointRef)
95-
if predicate(frame) || shouldbreak(frame, pc)
96-
return pc
97-
end
95+
shouldbreak(frame, pc) && return BreakpointRef(frame.framecode, pc)
96+
predicate(frame) && return pc
9897
pc = step_expr!(recurse, frame, istoplevel)
9998
end
10099
return pc

test/debug.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,4 +470,16 @@ struct B{T} end
470470
break_off(:error)
471471
end
472472
end
473+
474+
@testset "breakpoint in next line" begin
475+
function f(a, b)
476+
a == 0 && return abs(b)
477+
@bp
478+
return b
479+
end
480+
481+
frame = JuliaInterpreter.enter_call(f, 5, 10)
482+
frame, pc = JuliaInterpreter.debug_command(frame, :n)
483+
@test pc isa BreakpointRef
484+
end
473485
# end

0 commit comments

Comments
 (0)