diff options
Diffstat (limited to 'lib/debug.rb')
-rw-r--r-- | lib/debug.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/debug.rb b/lib/debug.rb index d2f1da83ff..f257e0c777 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -25,6 +25,8 @@ class DEBUGGER__ @last_file = nil @last = [nil, nil] @scripts = {} + @no_step = nil + @finish_pos = 0 end DEBUG_LAST_CMD = [] @@ -254,9 +256,13 @@ class DEBUGGER__ STDOUT.printf "#%d %s\n", frame_pos, info when /^fi(?:nish)?$/ - @finish_pos = @frames.size - frame_pos - frame_pos = 0 - return + if frame_pos == 0 + STDOUT.print "\"finish\" not meaningful in the outermost frame.\n" + else + @finish_pos = @frames.size - frame_pos + frame_pos = 0 + return + end when /^q(?:uit)?$/ input = readline("really quit? (y/n) ", false) @@ -383,10 +389,10 @@ class DEBUGGER__ @frames.unshift binding when 'return', 'end' + @frames.shift if @frames.size == @finish_pos @stop_next = 1 end - @frames.shift when 'raise' excn_handle(file, line, id, binding) |