Skip to content

Commit 38a318b

Browse files
authored
fast forward over nothing statements (#61)
* fast forward over nothing statements * use maybe_next_call! instead * Update Debugger.jl
1 parent a237595 commit 38a318b

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

src/commands.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function execute_command(state::DebuggerState, ::Union{Val{:c},Val{:nc},Val{:n},
5151
state.broke_on_error = true
5252
end
5353
end
54+
JuliaInterpreter.maybe_next_call!(state.frame)
5455
return true
5556
end
5657
end

src/printing.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,8 @@ end
3939

4040
function print_next_expr(io::IO, frame::Frame)
4141
maybe_quote(x) = (isa(x, Expr) || isa(x, Symbol)) ? QuoteNode(x) : x
42-
43-
pc = frame.pc
44-
expr = pc_expr(frame, pc)
45-
while expr === nothing
46-
pc += 1
47-
pc <= nstatements(frame.framecode) || return nothing
48-
expr = pc_expr(frame, pc)
49-
end
42+
expr = pc_expr(frame)
43+
@assert expr !== nothing
5044
print(io, "About to run: ")
5145
isa(expr, Expr) && (expr = copy(expr))
5246
if isexpr(expr, :(=))

test/misc.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ execute_command(state, Val{:so}(), "c")
4444
@test state.overall_result == 2
4545

4646
@inline fnothing(x) = 1
47-
frame = JuliaInterpreter.enter_call(fnothing, 0)
47+
frame = @make_frame fnothing(0)
4848
io = IOBuffer()
4949
Debugger.print_next_expr(io, frame)
5050
@test chomp(String(take!(io))) == "About to run: return 1"

0 commit comments

Comments
 (0)