/
continue.rb
50 lines (39 loc) · 1.11 KB
/
continue.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# frozen_string_literal: true
require "byebug/command"
require "byebug/helpers/parse"
module Byebug
#
# Implements the continue command.
#
# Allows the user to continue execution until the next stopping point, a
# specific line number or until program termination.
#
class ContinueCommand < Command
include Helpers::ParseHelper
def self.regexp
/^\s* c(?:ont(?:inue)?)? (?:\s+(\S+))? \s*$/x
end
def self.description
<<-DESCRIPTION
c[ont[inue]][ <line_number>]
#{short_description}
DESCRIPTION
end
def self.short_description
"Runs until program ends, hits a breakpoint or reaches a line"
end
def execute
if @match[1]
num, err = get_int(@match[1], "Continue", 0, nil)
return errmsg(err) unless num
filename = File.expand_path(frame.file)
unless Breakpoint.potential_line?(filename, num)
return errmsg(pr("continue.errors.unstopped_line", line: num))
end
Breakpoint.add(filename, num)
end
processor.proceed!
Byebug.stop if Byebug.stoppable?
end
end
end