Skip to content

Commit

Permalink
pop top frame from stack if we throw evaluating it (#111)
Browse files Browse the repository at this point in the history
* pop top frame from stack if we error evaluating it

* add breakpoint test
  • Loading branch information
KristofferC authored Mar 7, 2019
1 parent 95e8a6e commit 0ab4fe4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ function evaluate_call!(stack, frame::JuliaStackFrame, call_expr::Expr, pc; exec
push!(stack, newframe)
return BreakpointRef(newframe.code, newframe.pc[])
end
ret = exec!(stack, newframe)
ret = try
exec!(stack, newframe)
catch e
pop!(stack)
rethrow(e)
end
isa(ret, BreakpointRef) && return ret
pop!(stack)
push!(junk, newframe) # rather than going through GC, just re-use it
Expand Down
1 change: 1 addition & 0 deletions test/breakpoints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ end
frame = JuliaInterpreter.enter_call(f_exc_outer);
v = JuliaInterpreter.finish_and_return!(stack, frame)
@test v isa ErrorException
@test isempty(stack)
finally
JuliaInterpreter.break_on_error[] = false
end
Expand Down

0 comments on commit 0ab4fe4

Please sign in to comment.