Skip to content

Commit 3191635

Browse files
committed
Don't fail when stepping and there is no call
1 parent 4b6a8ae commit 3191635

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/commands.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ function debug_command(@nospecialize(recurse), frame::Frame, cmd::AbstractString
330330
pc = maybe_next_call!(recurse, frame, istoplevel)
331331
(isa(pc, BreakpointRef) || pc === nothing) && return maybe_reset_frame!(recurse, frame, pc, rootistoplevel)
332332
stmt0 = stmt = pc_expr(frame, pc)
333+
isexpr(stmt0, :return) && return maybe_reset_frame!(recurse, frame, nothing, rootistoplevel)
333334
if isexpr(stmt, :(=))
334335
stmt = stmt.args[2]
335336
end

test/debug.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ macro insert_some_calls()
2222
end)
2323
end
2424

25+
trivial(x) = x
26+
2527
struct B{T} end
2628

2729
# @testset "Debug" begin
@@ -50,6 +52,11 @@ struct B{T} end
5052
f22() = string(QuoteNode(:a))
5153
@test step_through(enter_call(f22)) == ":a"
5254

55+
frame = enter_call(trivial, 2)
56+
@test debug_command(frame, "s") === nothing
57+
@test get_return(frame) == 2
58+
59+
@test step_through(enter_call(trivial, 2)) == 2
5360
@test step_through(enter_call_expr(:($(+)(1,2.5)))) == 3.5
5461
@test step_through(enter_call_expr(:($(sin)(1)))) == sin(1)
5562
@test step_through(enter_call_expr(:($(gcd)(10,20)))) == gcd(10, 20)

0 commit comments

Comments
 (0)