byebug 9.0.5 → 11.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +399 -264
- data/CONTRIBUTING.md +12 -19
- data/GUIDE.md +40 -26
- data/LICENSE +18 -18
- data/README.md +103 -74
- data/exe/byebug +6 -0
- data/ext/byebug/breakpoint.c +2 -2
- data/ext/byebug/byebug.c +26 -31
- data/ext/byebug/byebug.h +44 -28
- data/ext/byebug/context.c +45 -32
- data/ext/byebug/extconf.rb +7 -5
- data/ext/byebug/locker.c +4 -4
- data/ext/byebug/threads.c +12 -12
- data/lib/byebug/attacher.rb +18 -4
- data/lib/byebug/breakpoint.rb +26 -6
- data/lib/byebug/command.rb +20 -14
- data/lib/byebug/command_list.rb +3 -1
- data/lib/byebug/commands/break.rb +36 -22
- data/lib/byebug/commands/catch.rb +16 -18
- data/lib/byebug/commands/condition.rb +11 -11
- data/lib/byebug/commands/continue.rb +32 -12
- data/lib/byebug/commands/debug.rb +7 -5
- data/lib/byebug/commands/delete.rb +13 -11
- data/lib/byebug/commands/disable/breakpoints.rb +7 -5
- data/lib/byebug/commands/disable/display.rb +7 -5
- data/lib/byebug/commands/disable.rb +8 -6
- data/lib/byebug/commands/display.rb +11 -9
- data/lib/byebug/commands/down.rb +10 -8
- data/lib/byebug/commands/edit.rb +11 -8
- data/lib/byebug/commands/enable/breakpoints.rb +7 -5
- data/lib/byebug/commands/enable/display.rb +7 -5
- data/lib/byebug/commands/enable.rb +8 -6
- data/lib/byebug/commands/finish.rb +9 -7
- data/lib/byebug/commands/frame.rb +11 -9
- data/lib/byebug/commands/help.rb +7 -5
- data/lib/byebug/commands/history.rb +7 -5
- data/lib/byebug/commands/info/breakpoints.rb +18 -14
- data/lib/byebug/commands/info/display.rb +16 -9
- data/lib/byebug/commands/info/file.rb +13 -14
- data/lib/byebug/commands/info/line.rb +5 -3
- data/lib/byebug/commands/info/program.rb +8 -6
- data/lib/byebug/commands/info.rb +11 -9
- data/lib/byebug/commands/interrupt.rb +8 -4
- data/lib/byebug/commands/irb.rb +13 -12
- data/lib/byebug/commands/kill.rb +11 -11
- data/lib/byebug/commands/list.rb +41 -46
- data/lib/byebug/commands/method.rb +10 -8
- data/lib/byebug/commands/next.rb +8 -6
- data/lib/byebug/commands/pry.rb +10 -10
- data/lib/byebug/commands/quit.rb +10 -8
- data/lib/byebug/commands/restart.rb +30 -11
- data/lib/byebug/commands/save.rb +10 -8
- data/lib/byebug/commands/set.rb +13 -11
- data/lib/byebug/commands/show.rb +7 -5
- data/lib/byebug/commands/skip.rb +85 -0
- data/lib/byebug/commands/source.rb +7 -7
- data/lib/byebug/commands/step.rb +8 -6
- data/lib/byebug/commands/thread/current.rb +6 -4
- data/lib/byebug/commands/thread/list.rb +7 -5
- data/lib/byebug/commands/thread/resume.rb +7 -7
- data/lib/byebug/commands/thread/stop.rb +6 -4
- data/lib/byebug/commands/thread/switch.rb +6 -4
- data/lib/byebug/commands/thread.rb +11 -9
- data/lib/byebug/commands/tracevar.rb +10 -11
- data/lib/byebug/commands/undisplay.rb +12 -11
- data/lib/byebug/commands/untracevar.rb +8 -6
- data/lib/byebug/commands/up.rb +10 -8
- data/lib/byebug/commands/var/all.rb +7 -5
- data/lib/byebug/commands/var/args.rb +6 -4
- data/lib/byebug/commands/var/const.rb +9 -9
- data/lib/byebug/commands/var/global.rb +5 -3
- data/lib/byebug/commands/var/instance.rb +6 -4
- data/lib/byebug/commands/var/local.rb +6 -4
- data/lib/byebug/commands/var.rb +12 -10
- data/lib/byebug/commands/where.rb +9 -7
- data/lib/byebug/commands.rb +40 -37
- data/lib/byebug/context.rb +7 -5
- data/lib/byebug/core.rb +26 -25
- data/lib/byebug/errors.rb +4 -2
- data/lib/byebug/frame.rb +19 -22
- data/lib/byebug/helpers/bin.rb +47 -0
- data/lib/byebug/helpers/eval.rb +15 -13
- data/lib/byebug/helpers/file.rb +6 -4
- data/lib/byebug/helpers/frame.rb +7 -5
- data/lib/byebug/helpers/parse.rb +5 -5
- data/lib/byebug/helpers/path.rb +9 -11
- data/lib/byebug/helpers/reflection.rb +2 -0
- data/lib/byebug/helpers/string.rb +11 -2
- data/lib/byebug/helpers/thread.rb +10 -8
- data/lib/byebug/helpers/toggle.rb +28 -27
- data/lib/byebug/helpers/var.rb +9 -7
- data/lib/byebug/history.rb +20 -11
- data/lib/byebug/interface.rb +13 -11
- data/lib/byebug/interfaces/local_interface.rb +25 -7
- data/lib/byebug/interfaces/remote_interface.rb +21 -9
- data/lib/byebug/interfaces/script_interface.rb +4 -1
- data/lib/byebug/interfaces/test_interface.rb +5 -3
- data/lib/byebug/option_setter.rb +14 -12
- data/lib/byebug/printers/base.rb +10 -10
- data/lib/byebug/printers/plain.rb +9 -8
- data/lib/byebug/printers/texts/base.yml +7 -3
- data/lib/byebug/printers/texts/plain.yml +1 -1
- data/lib/byebug/processors/command_processor.rb +11 -12
- data/lib/byebug/processors/control_processor.rb +4 -6
- data/lib/byebug/processors/post_mortem_processor.rb +4 -2
- data/lib/byebug/processors/script_processor.rb +7 -3
- data/lib/byebug/remote/client.rb +57 -0
- data/lib/byebug/remote/server.rb +47 -0
- data/lib/byebug/remote.rb +46 -66
- data/lib/byebug/runner.rb +43 -49
- data/lib/byebug/setting.rb +11 -5
- data/lib/byebug/settings/autoirb.rb +7 -5
- data/lib/byebug/settings/autolist.rb +7 -5
- data/lib/byebug/settings/autopry.rb +7 -5
- data/lib/byebug/settings/autosave.rb +4 -2
- data/lib/byebug/settings/basename.rb +4 -2
- data/lib/byebug/settings/callstyle.rb +4 -3
- data/lib/byebug/settings/fullpath.rb +4 -2
- data/lib/byebug/settings/histfile.rb +5 -3
- data/lib/byebug/settings/histsize.rb +4 -2
- data/lib/byebug/settings/linetrace.rb +6 -4
- data/lib/byebug/settings/listsize.rb +4 -2
- data/lib/byebug/settings/post_mortem.rb +6 -4
- data/lib/byebug/settings/savefile.rb +4 -2
- data/lib/byebug/settings/stack_on_error.rb +4 -2
- data/lib/byebug/settings/width.rb +3 -1
- data/lib/byebug/source_file_formatter.rb +71 -0
- data/lib/byebug/subcommands.rb +6 -4
- data/lib/byebug/version.rb +2 -1
- data/lib/byebug.rb +3 -1
- metadata +22 -20
- data/bin/byebug +0 -7
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../helpers/toggle"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -18,22 +20,22 @@ module Byebug
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.description
|
21
|
-
<<-
|
23
|
+
<<-DESCRIPTION
|
22
24
|
dis[able] b[reakpoints][ <id1> <id2> .. <idn>]
|
23
25
|
|
24
26
|
#{short_description}
|
25
27
|
|
26
28
|
Give breakpoint numbers (separated by spaces) as arguments or no
|
27
29
|
argument at all if you want to disable every breakpoint.
|
28
|
-
|
30
|
+
DESCRIPTION
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.short_description
|
32
|
-
|
34
|
+
"Disable all or specific breakpoints."
|
33
35
|
end
|
34
36
|
|
35
37
|
def execute
|
36
|
-
enable_disable_breakpoints(
|
38
|
+
enable_disable_breakpoints("disable", @match[1])
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../helpers/toggle"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -18,7 +20,7 @@ module Byebug
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.description
|
21
|
-
<<-
|
23
|
+
<<-DESCRIPTION
|
22
24
|
dis[able] d[isplay][ <id1> <id2> .. <idn>]
|
23
25
|
|
24
26
|
#{short_description}
|
@@ -26,15 +28,15 @@ module Byebug
|
|
26
28
|
Arguments are the code numbers of the expressions to disable. Do "info
|
27
29
|
display" to see the current list of code numbers. If no arguments are
|
28
30
|
specified, all displays are disabled.
|
29
|
-
|
31
|
+
DESCRIPTION
|
30
32
|
end
|
31
33
|
|
32
34
|
def self.short_description
|
33
|
-
|
35
|
+
"Disables expressions to be displayed when program stops."
|
34
36
|
end
|
35
37
|
|
36
38
|
def execute
|
37
|
-
enable_disable_display(
|
39
|
+
enable_disable_display("disable", @match[1])
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative "../subcommands"
|
4
|
+
|
5
|
+
require_relative "../commands/disable/breakpoints"
|
6
|
+
require_relative "../commands/disable/display"
|
5
7
|
|
6
8
|
module Byebug
|
7
9
|
#
|
@@ -17,15 +19,15 @@ module Byebug
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def self.description
|
20
|
-
<<-
|
22
|
+
<<-DESCRIPTION
|
21
23
|
dis[able][[ breakpoints| display)][ n1[ n2[ ...[ nn]]]]]
|
22
24
|
|
23
25
|
#{short_description}
|
24
|
-
|
26
|
+
DESCRIPTION
|
25
27
|
end
|
26
28
|
|
27
29
|
def self.short_description
|
28
|
-
|
30
|
+
"Disables breakpoints or displays"
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
4
|
+
require_relative "../helpers/eval"
|
3
5
|
|
4
6
|
module Byebug
|
5
7
|
#
|
@@ -16,18 +18,18 @@ module Byebug
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def self.description
|
19
|
-
<<-
|
21
|
+
<<-DESCRIPTION
|
20
22
|
disp[lay][ <expression>]
|
21
23
|
|
22
24
|
#{short_description}
|
23
25
|
|
24
26
|
If <expression> specified, adds <expression> into display expression
|
25
27
|
list. Otherwise, it lists all expressions.
|
26
|
-
|
28
|
+
DESCRIPTION
|
27
29
|
end
|
28
30
|
|
29
31
|
def self.short_description
|
30
|
-
|
32
|
+
"Evaluates expressions every time the debugger stops"
|
31
33
|
end
|
32
34
|
|
33
35
|
def execute
|
@@ -40,13 +42,13 @@ module Byebug
|
|
40
42
|
private
|
41
43
|
|
42
44
|
def display_expression(exp)
|
43
|
-
print pr(
|
45
|
+
print pr("display.result", n: Byebug.displays.size,
|
44
46
|
exp: exp,
|
45
47
|
result: eval_expr(exp))
|
46
48
|
end
|
47
49
|
|
48
50
|
def print_display_expressions
|
49
|
-
result = prc(
|
51
|
+
result = prc("display.result", Byebug.displays) do |item, index|
|
50
52
|
active, exp = item
|
51
53
|
|
52
54
|
{ n: index + 1, exp: exp, result: eval_expr(exp) } if active
|
@@ -57,8 +59,8 @@ module Byebug
|
|
57
59
|
|
58
60
|
def eval_expr(expression)
|
59
61
|
error_eval(expression).inspect
|
60
|
-
rescue
|
61
|
-
|
62
|
+
rescue StandardError
|
63
|
+
"(undefined)"
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|
data/lib/byebug/commands/down.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pathname"
|
4
|
+
require_relative "../command"
|
5
|
+
require_relative "../helpers/frame"
|
6
|
+
require_relative "../helpers/parse"
|
5
7
|
|
6
8
|
module Byebug
|
7
9
|
#
|
@@ -18,21 +20,21 @@ module Byebug
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.description
|
21
|
-
<<-
|
23
|
+
<<-DESCRIPTION
|
22
24
|
down[ count]
|
23
25
|
|
24
26
|
#{short_description}
|
25
27
|
|
26
28
|
Use the "bt" command to find out where you want to go.
|
27
|
-
|
29
|
+
DESCRIPTION
|
28
30
|
end
|
29
31
|
|
30
32
|
def self.short_description
|
31
|
-
|
33
|
+
"Moves to a lower frame in the stack trace"
|
32
34
|
end
|
33
35
|
|
34
36
|
def execute
|
35
|
-
pos, err = parse_steps(@match[1],
|
37
|
+
pos, err = parse_steps(@match[1], "Down")
|
36
38
|
return errmsg(err) unless pos
|
37
39
|
|
38
40
|
jump_frames(-pos)
|
data/lib/byebug/commands/edit.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -13,7 +15,7 @@ module Byebug
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.description
|
16
|
-
<<-
|
18
|
+
<<-DESCRIPTION
|
17
19
|
edit[ file:lineno]
|
18
20
|
|
19
21
|
#{short_description}
|
@@ -21,17 +23,17 @@ module Byebug
|
|
21
23
|
With no argumnt, edits file containing most re line listed. Editing
|
22
24
|
targets can also be specified to start editing at a specific line in a
|
23
25
|
specific file
|
24
|
-
|
26
|
+
DESCRIPTION
|
25
27
|
end
|
26
28
|
|
27
29
|
def self.short_description
|
28
|
-
|
30
|
+
"Edits source files"
|
29
31
|
end
|
30
32
|
|
31
33
|
def execute
|
32
34
|
file, line = location(@match[1])
|
33
|
-
return edit_error(
|
34
|
-
return edit_error(
|
35
|
+
return edit_error("not_exist", file) unless File.exist?(file)
|
36
|
+
return edit_error("not_readable", file) unless File.readable?(file)
|
35
37
|
|
36
38
|
cmd = line ? "#{editor} +#{line} #{file}" : "#{editor} #{file}"
|
37
39
|
|
@@ -43,7 +45,8 @@ module Byebug
|
|
43
45
|
def location(matched)
|
44
46
|
if matched.nil?
|
45
47
|
file = frame.file
|
46
|
-
return errmsg(pr(
|
48
|
+
return errmsg(pr("edit.errors.state")) unless file
|
49
|
+
|
47
50
|
line = frame.line
|
48
51
|
elsif (@pos_match = /([^:]+)[:]([0-9]+)/.match(matched))
|
49
52
|
file, line = @pos_match.captures
|
@@ -56,7 +59,7 @@ module Byebug
|
|
56
59
|
end
|
57
60
|
|
58
61
|
def editor
|
59
|
-
ENV[
|
62
|
+
ENV["EDITOR"] || "vim"
|
60
63
|
end
|
61
64
|
|
62
65
|
def edit_error(type, file)
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../helpers/toggle"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -18,22 +20,22 @@ module Byebug
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.description
|
21
|
-
<<-
|
23
|
+
<<-DESCRIPTION
|
22
24
|
en[able] b[reakpoints][ <ids>]
|
23
25
|
|
24
26
|
#{short_description}
|
25
27
|
|
26
28
|
Give breakpoint numbers (separated by spaces) as arguments or no
|
27
29
|
argument at all if you want to enable every breakpoint.
|
28
|
-
|
30
|
+
DESCRIPTION
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.short_description
|
32
|
-
|
34
|
+
"Enable all or specific breakpoints"
|
33
35
|
end
|
34
36
|
|
35
37
|
def execute
|
36
|
-
enable_disable_breakpoints(
|
38
|
+
enable_disable_breakpoints("enable", @match[1])
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../helpers/toggle"
|
2
4
|
|
3
5
|
module Byebug
|
4
6
|
#
|
@@ -18,7 +20,7 @@ module Byebug
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.description
|
21
|
-
<<-
|
23
|
+
<<-DESCRIPTION
|
22
24
|
en[able] d[isplay][ <id1> <id2> .. <idn>]
|
23
25
|
|
24
26
|
#{short_description}
|
@@ -26,15 +28,15 @@ module Byebug
|
|
26
28
|
Arguments are the code numbers of the expressions to enable. Do "info
|
27
29
|
display" to see the current list of code numbers. If no arguments are
|
28
30
|
specified, all displays are enabled.
|
29
|
-
|
31
|
+
DESCRIPTION
|
30
32
|
end
|
31
33
|
|
32
34
|
def self.short_description
|
33
|
-
|
35
|
+
"Enables expressions to be displayed when program stops."
|
34
36
|
end
|
35
37
|
|
36
38
|
def execute
|
37
|
-
enable_disable_display(
|
39
|
+
enable_disable_display("enable", @match[1])
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative "../subcommands"
|
4
|
+
|
5
|
+
require_relative "../commands/enable/breakpoints"
|
6
|
+
require_relative "../commands/enable/display"
|
5
7
|
|
6
8
|
module Byebug
|
7
9
|
#
|
@@ -17,15 +19,15 @@ module Byebug
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def self.description
|
20
|
-
<<-
|
22
|
+
<<-DESCRIPTION
|
21
23
|
en[able][[ b[reakpoints]| d[isplay])][ n1[ n2[ ...[ nn]]]]]
|
22
24
|
|
23
25
|
#{short_description}
|
24
|
-
|
26
|
+
DESCRIPTION
|
25
27
|
end
|
26
28
|
|
27
29
|
def self.short_description
|
28
|
-
|
30
|
+
"Enables breakpoints or displays"
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
4
|
+
require_relative "../helpers/parse"
|
3
5
|
|
4
6
|
module Byebug
|
5
7
|
#
|
@@ -17,7 +19,7 @@ module Byebug
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def self.description
|
20
|
-
<<-
|
22
|
+
<<-DESCRIPTION
|
21
23
|
fin[ish][ n_frames]
|
22
24
|
|
23
25
|
#{short_description}
|
@@ -25,22 +27,22 @@ module Byebug
|
|
25
27
|
If no number is given, we run until the current frame returns. If a
|
26
28
|
number of frames `n_frames` is given, then we run until `n_frames`
|
27
29
|
return from the current position.
|
28
|
-
|
30
|
+
DESCRIPTION
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.short_description
|
32
|
-
|
34
|
+
"Runs the program until frame returns"
|
33
35
|
end
|
34
36
|
|
35
37
|
def execute
|
36
38
|
if @match[1]
|
37
|
-
n_frames, err = get_int(@match[1],
|
39
|
+
n_frames, err = get_int(@match[1], "finish", 0, max_frames - 1)
|
38
40
|
return errmsg(err) unless n_frames
|
39
41
|
else
|
40
42
|
n_frames = 1
|
41
43
|
end
|
42
44
|
|
43
|
-
force = n_frames
|
45
|
+
force = n_frames.zero? ? true : false
|
44
46
|
context.step_out(context.frame.pos + n_frames, force)
|
45
47
|
context.frame = 0
|
46
48
|
processor.proceed!
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pathname"
|
4
|
+
require_relative "../command"
|
5
|
+
require_relative "../helpers/frame"
|
6
|
+
require_relative "../helpers/parse"
|
5
7
|
|
6
8
|
module Byebug
|
7
9
|
#
|
@@ -18,7 +20,7 @@ module Byebug
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def self.description
|
21
|
-
<<-
|
23
|
+
<<-DESCRIPTION
|
22
24
|
f[rame][ frame-number]
|
23
25
|
|
24
26
|
#{short_description}
|
@@ -34,17 +36,17 @@ module Byebug
|
|
34
36
|
if there is a front end also watching over things.
|
35
37
|
|
36
38
|
Use the "bt" command to find out where you want to go.
|
37
|
-
|
39
|
+
DESCRIPTION
|
38
40
|
end
|
39
41
|
|
40
42
|
def self.short_description
|
41
|
-
|
43
|
+
"Moves to a frame in the call stack"
|
42
44
|
end
|
43
45
|
|
44
46
|
def execute
|
45
|
-
return print(pr(
|
47
|
+
return print(pr("frame.line", context.frame.to_hash)) unless @match[1]
|
46
48
|
|
47
|
-
pos, err = get_int(@match[1],
|
49
|
+
pos, err = get_int(@match[1], "Frame")
|
48
50
|
return errmsg(err) unless pos
|
49
51
|
|
50
52
|
switch_to_frame(pos)
|
data/lib/byebug/commands/help.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
4
|
+
require_relative "../errors"
|
3
5
|
|
4
6
|
module Byebug
|
5
7
|
#
|
@@ -14,7 +16,7 @@ module Byebug
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def self.description
|
17
|
-
<<-
|
19
|
+
<<-DESCRIPTION
|
18
20
|
h[elp][ <cmd>[ <subcmd>]]
|
19
21
|
|
20
22
|
#{short_description}
|
@@ -22,11 +24,11 @@ module Byebug
|
|
22
24
|
help -- prints a summary of all commands
|
23
25
|
help <cmd> -- prints help on command <cmd>
|
24
26
|
help <cmd> <subcmd> -- prints help on <cmd>'s subcommand <subcmd>
|
25
|
-
|
27
|
+
DESCRIPTION
|
26
28
|
end
|
27
29
|
|
28
30
|
def self.short_description
|
29
|
-
|
31
|
+
"Helps you using byebug"
|
30
32
|
end
|
31
33
|
|
32
34
|
def execute
|
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../command"
|
4
|
+
require_relative "../helpers/parse"
|
3
5
|
|
4
6
|
module Byebug
|
5
7
|
#
|
@@ -15,11 +17,11 @@ module Byebug
|
|
15
17
|
end
|
16
18
|
|
17
19
|
def self.description
|
18
|
-
<<-
|
20
|
+
<<-DESCRIPTION
|
19
21
|
hist[ory][ num_cmds]
|
20
22
|
|
21
23
|
#{short_description}
|
22
|
-
|
24
|
+
DESCRIPTION
|
23
25
|
end
|
24
26
|
|
25
27
|
def self.short_description
|
@@ -29,7 +31,7 @@ module Byebug
|
|
29
31
|
def execute
|
30
32
|
history = processor.interface.history
|
31
33
|
|
32
|
-
size, = get_int(@match[:num_cmds],
|
34
|
+
size, = get_int(@match[:num_cmds], "history", 1) if @match[:num_cmds]
|
33
35
|
|
34
36
|
puts history.to_s(size)
|
35
37
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
#
|
3
5
|
# Reopens the +info+ command to define the +breakpoints+ subcommand
|
@@ -14,46 +16,48 @@ module Byebug
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def self.description
|
17
|
-
<<-
|
19
|
+
<<-DESCRIPTION
|
18
20
|
inf[o] b[reakpoints]
|
19
21
|
|
20
22
|
#{short_description}
|
21
|
-
|
23
|
+
DESCRIPTION
|
22
24
|
end
|
23
25
|
|
24
26
|
def self.short_description
|
25
|
-
|
27
|
+
"Status of user settable breakpoints"
|
26
28
|
end
|
27
29
|
|
28
30
|
def execute
|
29
|
-
return puts(
|
31
|
+
return puts("No breakpoints.") if Byebug.breakpoints.empty?
|
30
32
|
|
31
33
|
breakpoints = Byebug.breakpoints.sort_by(&:id)
|
32
34
|
|
33
35
|
if @match[1]
|
34
36
|
indices = @match[1].split(/ +/).map(&:to_i)
|
35
37
|
breakpoints = breakpoints.select { |b| indices.member?(b.id) }
|
36
|
-
if breakpoints.empty?
|
37
|
-
return errmsg('No breakpoints found among list given')
|
38
|
-
end
|
38
|
+
return errmsg("No breakpoints found among list given") if breakpoints.empty?
|
39
39
|
end
|
40
40
|
|
41
|
-
puts
|
41
|
+
puts "Num Enb What"
|
42
42
|
breakpoints.each { |b| info_breakpoint(b) }
|
43
43
|
end
|
44
44
|
|
45
45
|
private
|
46
46
|
|
47
47
|
def info_breakpoint(brkpt)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
interp = format(
|
49
|
+
"%-<id>3d %-<status>3s at %<file>s:%<line>s%<expression>s",
|
50
|
+
id: brkpt.id,
|
51
|
+
status: brkpt.enabled? ? "y" : "n",
|
52
|
+
file: brkpt.source,
|
53
|
+
line: brkpt.pos,
|
54
|
+
expression: brkpt.expr.nil? ? "" : " if #{brkpt.expr}"
|
55
|
+
)
|
52
56
|
puts interp
|
53
57
|
hits = brkpt.hit_count
|
54
|
-
return unless hits
|
58
|
+
return unless hits.positive?
|
55
59
|
|
56
|
-
s =
|
60
|
+
s = hits > 1 ? "s" : ""
|
57
61
|
puts " breakpoint already hit #{hits} time#{s}"
|
58
62
|
end
|
59
63
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Byebug
|
2
4
|
#
|
3
5
|
# Reopens the +info+ command to define the +display+ subcommand
|
@@ -14,27 +16,32 @@ module Byebug
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def self.description
|
17
|
-
<<-
|
19
|
+
<<-DESCRIPTION
|
18
20
|
inf[o] d[display]
|
19
21
|
|
20
22
|
#{short_description}
|
21
|
-
|
23
|
+
DESCRIPTION
|
22
24
|
end
|
23
25
|
|
24
26
|
def self.short_description
|
25
|
-
|
27
|
+
"List of expressions to display when program stops"
|
26
28
|
end
|
27
29
|
|
28
30
|
def execute
|
29
|
-
unless Byebug.displays.find { |d| d[0] }
|
30
|
-
return puts('There are no auto-display expressions now.')
|
31
|
-
end
|
31
|
+
return puts("There are no auto-display expressions now.") unless Byebug.displays.find { |d| d[0] }
|
32
32
|
|
33
|
-
puts
|
34
|
-
puts
|
33
|
+
puts "Auto-display expressions now in effect:"
|
34
|
+
puts "Num Enb Expression"
|
35
35
|
|
36
36
|
Byebug.displays.each_with_index do |d, i|
|
37
|
-
|
37
|
+
interp = format(
|
38
|
+
"%<number>3d: %<status>s %<expression>s",
|
39
|
+
number: i + 1,
|
40
|
+
status: d[0] ? "y" : "n",
|
41
|
+
expression: d[1]
|
42
|
+
)
|
43
|
+
|
44
|
+
puts(interp)
|
38
45
|
end
|
39
46
|
end
|
40
47
|
end
|