Skip to content

Commit 4446267

Browse files
committed
fixes to breakpointing in next_line!
1 parent a64772e commit 4446267

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/interpret.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ function next_line!(stack, frame, dbstack = nothing)
710710
# If this is a goto node, step it and reevaluate
711711
if isgotonode(expr)
712712
pc = _step_expr!(stack, frame, pc)
713-
pc == nothing && return nothing
713+
(pc == nothing || isa(pc, Breakpoint)) && return pc
714714
elseif dbstack !== nothing && iswrappercall(expr)
715715
# With splatting it can happen that we do something like ssa = tuple(#self#), _apply(ssa), which
716716
# confuses the logic here, just step into the first call that's not a builtin
@@ -727,15 +727,15 @@ function next_line!(stack, frame, dbstack = nothing)
727727
break
728728
else
729729
pc = _step_expr!(stack, frame, pc)
730-
pc == nothing && return nothing
730+
(pc == nothing || isa(pc, Breakpoint)) && return pc
731731
end
732732
end
733733
else
734734
pc = _step_expr!(stack, frame, pc)
735-
pc == nothing && return nothing
735+
(pc == nothing || isa(pc, Breakpoint)) && return pc
736736
end
737737
frame.pc[] = pc
738-
shouldbreak(frame, pc) && break
738+
shouldbreak(frame, pc) && return Breakpoint(frame.code, pc)
739739
end
740740
maybe_next_call!(stack, frame, pc)
741741
end

test/breakpoints.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,18 @@ end
4848
@test s_extractor(frame) == loop_radius2(7)
4949
Breakpoints.disable(bp)
5050
@test JuliaInterpreter.finish_stack!(stack) == loop_radius2(10)
51+
52+
# Next line with breakpoints
53+
function outer(x)
54+
inner(x)
55+
end
56+
function inner(x)
57+
return 2
58+
end
59+
breakpoint(inner)
60+
stack = JuliaStackFrame[]
61+
frame = JuliaInterpreter.enter_call(outer, 2)
62+
bp = JuliaInterpreter.next_line!(stack, frame)
63+
@test isa(bp, Breakpoints.Breakpoint)
64+
@test JuliaInterpreter.finish_stack!(stack) == 2
5165
end

0 commit comments

Comments
 (0)