byebug 5.0.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -1
- data/CONTRIBUTING.md +35 -13
- data/GUIDE.md +256 -198
- data/README.md +5 -11
- data/ext/byebug/byebug.c +5 -43
- data/ext/byebug/byebug.h +6 -1
- data/ext/byebug/context.c +4 -5
- data/lib/byebug/command.rb +64 -64
- data/lib/byebug/command_list.rb +32 -0
- data/lib/byebug/commands.rb +37 -0
- data/lib/byebug/commands/break.rb +45 -37
- data/lib/byebug/commands/catch.rb +52 -28
- data/lib/byebug/commands/condition.rb +19 -13
- data/lib/byebug/commands/continue.rb +15 -11
- data/lib/byebug/commands/delete.rb +18 -12
- data/lib/byebug/commands/disable.rb +9 -10
- data/lib/byebug/commands/disable/breakpoints.rb +13 -11
- data/lib/byebug/commands/disable/display.rb +13 -11
- data/lib/byebug/commands/display.rb +32 -24
- data/lib/byebug/commands/down.rb +18 -14
- data/lib/byebug/commands/edit.rb +42 -26
- data/lib/byebug/commands/enable.rb +9 -3
- data/lib/byebug/commands/enable/breakpoints.rb +13 -11
- data/lib/byebug/commands/enable/display.rb +13 -11
- data/lib/byebug/commands/finish.rb +23 -14
- data/lib/byebug/commands/frame.rb +21 -18
- data/lib/byebug/commands/help.rb +39 -16
- data/lib/byebug/commands/history.rb +16 -10
- data/lib/byebug/commands/info.rb +8 -5
- data/lib/byebug/commands/info/breakpoints.rb +16 -14
- data/lib/byebug/commands/info/display.rb +18 -18
- data/lib/byebug/commands/info/file.rb +22 -22
- data/lib/byebug/commands/info/line.rb +13 -11
- data/lib/byebug/commands/info/program.rb +13 -17
- data/lib/byebug/commands/interrupt.rb +13 -11
- data/lib/byebug/commands/irb.rb +16 -10
- data/lib/byebug/commands/kill.rb +19 -13
- data/lib/byebug/commands/list.rb +35 -24
- data/lib/byebug/commands/method.rb +25 -15
- data/lib/byebug/commands/next.rb +15 -13
- data/lib/byebug/commands/pry.rb +18 -11
- data/lib/byebug/commands/ps.rb +21 -23
- data/lib/byebug/commands/quit.rb +17 -11
- data/lib/byebug/commands/restart.rb +28 -24
- data/lib/byebug/commands/save.rb +23 -15
- data/lib/byebug/commands/set.rb +26 -19
- data/lib/byebug/commands/show.rb +20 -14
- data/lib/byebug/commands/source.rb +15 -14
- data/lib/byebug/commands/step.rb +15 -13
- data/lib/byebug/commands/thread.rb +8 -4
- data/lib/byebug/commands/thread/current.rb +11 -11
- data/lib/byebug/commands/thread/list.rb +14 -14
- data/lib/byebug/commands/thread/resume.rb +14 -14
- data/lib/byebug/commands/thread/stop.rb +14 -14
- data/lib/byebug/commands/thread/switch.rb +15 -14
- data/lib/byebug/commands/tracevar.rb +20 -16
- data/lib/byebug/commands/undisplay.rb +22 -18
- data/lib/byebug/commands/untracevar.rb +13 -11
- data/lib/byebug/commands/up.rb +18 -14
- data/lib/byebug/commands/var.rb +10 -3
- data/lib/byebug/commands/var/all.rb +15 -13
- data/lib/byebug/commands/var/args.rb +37 -0
- data/lib/byebug/commands/var/const.rb +25 -14
- data/lib/byebug/commands/var/global.rb +13 -11
- data/lib/byebug/commands/var/instance.rb +13 -11
- data/lib/byebug/commands/var/local.rb +13 -11
- data/lib/byebug/commands/where.rb +15 -11
- data/lib/byebug/context.rb +71 -73
- data/lib/byebug/core.rb +45 -26
- data/lib/byebug/errors.rb +27 -0
- data/lib/byebug/frame.rb +181 -0
- data/lib/byebug/helpers/eval.rb +67 -26
- data/lib/byebug/helpers/file.rb +18 -3
- data/lib/byebug/helpers/frame.rb +36 -39
- data/lib/byebug/helpers/parse.rb +15 -13
- data/lib/byebug/helpers/path.rb +21 -0
- data/lib/byebug/helpers/reflection.rb +17 -0
- data/lib/byebug/helpers/thread.rb +20 -14
- data/lib/byebug/helpers/toggle.rb +10 -5
- data/lib/byebug/helpers/var.rb +36 -15
- data/lib/byebug/interface.rb +27 -9
- data/lib/byebug/option_setter.rb +93 -0
- data/lib/byebug/printers/base.rb +3 -0
- data/lib/byebug/printers/plain.rb +4 -14
- data/lib/byebug/printers/texts/base.yml +2 -7
- data/lib/byebug/processors/command_processor.rb +101 -102
- data/lib/byebug/processors/control_processor.rb +20 -0
- data/lib/byebug/processors/post_mortem_processor.rb +16 -0
- data/lib/byebug/processors/script_processor.rb +49 -0
- data/lib/byebug/remote.rb +13 -7
- data/lib/byebug/runner.rb +39 -65
- data/lib/byebug/setting.rb +4 -1
- data/lib/byebug/settings/post_mortem.rb +0 -16
- data/lib/byebug/settings/savefile.rb +1 -4
- data/lib/byebug/subcommands.rb +27 -29
- data/lib/byebug/version.rb +4 -1
- metadata +14 -29
- data/lib/byebug/commands/eval.rb +0 -43
- data/lib/byebug/commands/info/args.rb +0 -39
- data/lib/byebug/commands/info/catch.rb +0 -39
- data/lib/byebug/commands/pp.rb +0 -41
- data/lib/byebug/commands/putl.rb +0 -43
- data/lib/byebug/processor.rb +0 -43
- data/lib/byebug/processors/control_command_processor.rb +0 -48
- data/lib/byebug/settings/verbose.rb +0 -20
- data/lib/byebug/state.rb +0 -12
- data/lib/byebug/states/control_state.rb +0 -26
- data/lib/byebug/states/regular_state.rb +0 -187
- data/lib/byebug/subcommand_list.rb +0 -33
data/lib/byebug/commands/set.rb
CHANGED
@@ -9,11 +9,34 @@ module Byebug
|
|
9
9
|
include Helpers::ParseHelper
|
10
10
|
|
11
11
|
self.allow_in_control = true
|
12
|
+
self.allow_in_post_mortem = true
|
12
13
|
|
13
|
-
def regexp
|
14
|
+
def self.regexp
|
14
15
|
/^\s* set (?:\s+(?<setting>\w+))? (?:\s+(?<value>\S+))? \s*$/x
|
15
16
|
end
|
16
17
|
|
18
|
+
def self.description
|
19
|
+
<<-EOD
|
20
|
+
set <setting> <value>
|
21
|
+
|
22
|
+
#{short_description}
|
23
|
+
|
24
|
+
Boolean values take "on", "off", "true", "false", "1" or "0". If you
|
25
|
+
don't specify a value, the boolean setting will be enabled. Conversely,
|
26
|
+
you can use "set no<setting>" to disable them.
|
27
|
+
|
28
|
+
You can see these environment settings with the "show" command.
|
29
|
+
EOD
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.short_description
|
33
|
+
'Modifies byebug settings'
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.help
|
37
|
+
super + Setting.help_all
|
38
|
+
end
|
39
|
+
|
17
40
|
def execute
|
18
41
|
key = @match[:setting]
|
19
42
|
value = @match[:value]
|
@@ -36,6 +59,8 @@ module Byebug
|
|
36
59
|
puts setting.to_s
|
37
60
|
end
|
38
61
|
|
62
|
+
private
|
63
|
+
|
39
64
|
def get_onoff(arg, default)
|
40
65
|
return default if arg.nil?
|
41
66
|
|
@@ -48,23 +73,5 @@ module Byebug
|
|
48
73
|
[nil, pr('set.errors.on_off', arg: arg)]
|
49
74
|
end
|
50
75
|
end
|
51
|
-
|
52
|
-
def help
|
53
|
-
description + Setting.help_all
|
54
|
-
end
|
55
|
-
|
56
|
-
def description
|
57
|
-
<<-EOD
|
58
|
-
set <setting> <value>
|
59
|
-
|
60
|
-
Modifies parts of byebug environment.
|
61
|
-
|
62
|
-
Boolean values take "on", "off", "true", "false", "1" or "0". If you
|
63
|
-
don't specify a value, the boolean setting will be enabled. Conversely,
|
64
|
-
you can use "set no<setting>" to disable them.
|
65
|
-
|
66
|
-
You can see these environment settings with the "show" command.
|
67
|
-
EOD
|
68
|
-
end
|
69
76
|
end
|
70
77
|
end
|
data/lib/byebug/commands/show.rb
CHANGED
@@ -6,11 +6,30 @@ module Byebug
|
|
6
6
|
#
|
7
7
|
class ShowCommand < Command
|
8
8
|
self.allow_in_control = true
|
9
|
+
self.allow_in_post_mortem = true
|
9
10
|
|
10
|
-
def regexp
|
11
|
+
def self.regexp
|
11
12
|
/^\s* show (?:\s+(?<setting>\w+))? \s*$/x
|
12
13
|
end
|
13
14
|
|
15
|
+
def self.description
|
16
|
+
<<-EOD
|
17
|
+
show <setting> <value>
|
18
|
+
|
19
|
+
#{short_description}
|
20
|
+
|
21
|
+
You can change them with the "set" command.
|
22
|
+
EOD
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.short_description
|
26
|
+
'Shows byebug settings'
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.help
|
30
|
+
super + Setting.help_all
|
31
|
+
end
|
32
|
+
|
14
33
|
def execute
|
15
34
|
key = @match[:setting]
|
16
35
|
return puts(help) unless key
|
@@ -20,18 +39,5 @@ module Byebug
|
|
20
39
|
|
21
40
|
puts Setting.settings[setting.to_sym]
|
22
41
|
end
|
23
|
-
|
24
|
-
def help
|
25
|
-
description + Setting.help_all
|
26
|
-
end
|
27
|
-
|
28
|
-
def description
|
29
|
-
<<-EOD
|
30
|
-
show <setting> <value>
|
31
|
-
|
32
|
-
Generic command for showing byebug settings. You can change them with
|
33
|
-
the "set" command.
|
34
|
-
EOD
|
35
|
-
end
|
36
42
|
end
|
37
43
|
end
|
@@ -8,32 +8,33 @@ module Byebug
|
|
8
8
|
#
|
9
9
|
class SourceCommand < Command
|
10
10
|
self.allow_in_control = true
|
11
|
+
self.allow_in_post_mortem = true
|
11
12
|
|
12
|
-
def regexp
|
13
|
+
def self.regexp
|
13
14
|
/^\s* so(?:urce)? (?:\s+(\S+))? \s*$/x
|
14
15
|
end
|
15
16
|
|
17
|
+
def self.description
|
18
|
+
<<-EOD
|
19
|
+
source <file>
|
20
|
+
|
21
|
+
#{short_description}
|
22
|
+
EOD
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.short_description
|
26
|
+
'Restores a previously saved byebug session'
|
27
|
+
end
|
28
|
+
|
16
29
|
def execute
|
17
30
|
return puts(help) unless @match[1]
|
18
31
|
|
19
|
-
unless @state && @state.interface
|
20
|
-
return errmsg(pr('source.errors.not_available'))
|
21
|
-
end
|
22
|
-
|
23
32
|
file = File.expand_path(@match[1]).strip
|
24
33
|
unless File.exist?(file)
|
25
34
|
return errmsg(pr('source.errors.not_found', file: file))
|
26
35
|
end
|
27
36
|
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def description
|
32
|
-
<<-EOD
|
33
|
-
source <file>
|
34
|
-
|
35
|
-
Executes file <file> containing byebug commands.
|
36
|
-
EOD
|
37
|
+
processor.interface.read_file(file)
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
data/lib/byebug/commands/step.rb
CHANGED
@@ -11,26 +11,28 @@ module Byebug
|
|
11
11
|
class StepCommand < Command
|
12
12
|
include Helpers::ParseHelper
|
13
13
|
|
14
|
-
self.
|
15
|
-
|
16
|
-
def regexp
|
14
|
+
def self.regexp
|
17
15
|
/^\s* s(?:tep)? (?:\s+(\S+))? \s*$/x
|
18
16
|
end
|
19
17
|
|
20
|
-
def
|
21
|
-
|
22
|
-
|
18
|
+
def self.description
|
19
|
+
<<-EOD
|
20
|
+
s[tep][ times]
|
23
21
|
|
24
|
-
|
25
|
-
|
22
|
+
#{short_description}
|
23
|
+
EOD
|
26
24
|
end
|
27
25
|
|
28
|
-
def
|
29
|
-
|
30
|
-
|
26
|
+
def self.short_description
|
27
|
+
'Steps into blocks or methods one or more times'
|
28
|
+
end
|
31
29
|
|
32
|
-
|
33
|
-
|
30
|
+
def execute
|
31
|
+
steps, err = parse_steps(@match[1], 'Steps')
|
32
|
+
return errmsg(err) unless steps
|
33
|
+
|
34
|
+
context.step_into(steps, context.frame.pos)
|
35
|
+
processor.proceed!
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
@@ -13,16 +13,20 @@ module Byebug
|
|
13
13
|
class ThreadCommand < Command
|
14
14
|
include Subcommands
|
15
15
|
|
16
|
-
def regexp
|
16
|
+
def self.regexp
|
17
17
|
/^\s* th(?:read)? (?:\s+ (.+))? \s*$/x
|
18
18
|
end
|
19
19
|
|
20
|
-
def description
|
20
|
+
def self.description
|
21
21
|
<<-EOD
|
22
|
-
th]
|
22
|
+
th[read] <subcommand>
|
23
23
|
|
24
|
-
|
24
|
+
#{short_description}
|
25
25
|
EOD
|
26
26
|
end
|
27
|
+
|
28
|
+
def self.short_description
|
29
|
+
'Commands to manipulate threads'
|
30
|
+
end
|
27
31
|
end
|
28
32
|
end
|
@@ -8,28 +8,28 @@ module Byebug
|
|
8
8
|
#
|
9
9
|
# Information about the current thread
|
10
10
|
#
|
11
|
-
class
|
11
|
+
class CurrentCommand < Command
|
12
12
|
include Helpers::ThreadHelper
|
13
13
|
|
14
|
-
def regexp
|
14
|
+
def self.regexp
|
15
15
|
/^\s* c(?:urrent)? \s*$/x
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
display_context(@state.context)
|
20
|
-
end
|
21
|
-
|
22
|
-
def short_description
|
23
|
-
'Shows current thread information'
|
24
|
-
end
|
25
|
-
|
26
|
-
def description
|
18
|
+
def self.description
|
27
19
|
<<-EOD
|
28
20
|
th[read] c[urrent]
|
29
21
|
|
30
22
|
#{short_description}
|
31
23
|
EOD
|
32
24
|
end
|
25
|
+
|
26
|
+
def self.short_description
|
27
|
+
'Shows current thread information'
|
28
|
+
end
|
29
|
+
|
30
|
+
def execute
|
31
|
+
display_context(context)
|
32
|
+
end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -8,13 +8,25 @@ module Byebug
|
|
8
8
|
#
|
9
9
|
# Information about threads
|
10
10
|
#
|
11
|
-
class
|
11
|
+
class ListCommand < Command
|
12
12
|
include Helpers::ThreadHelper
|
13
13
|
|
14
|
-
def regexp
|
14
|
+
def self.regexp
|
15
15
|
/^\s* l(?:ist)? \s*$/x
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.description
|
19
|
+
<<-EOD
|
20
|
+
th[read] l[ist] <thnum>
|
21
|
+
|
22
|
+
#{short_description}
|
23
|
+
EOD
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.short_description
|
27
|
+
'Lists all threads'
|
28
|
+
end
|
29
|
+
|
18
30
|
def execute
|
19
31
|
contexts = Byebug.contexts.sort_by(&:thnum)
|
20
32
|
|
@@ -24,18 +36,6 @@ module Byebug
|
|
24
36
|
|
25
37
|
print(thread_list)
|
26
38
|
end
|
27
|
-
|
28
|
-
def short_description
|
29
|
-
'Lists all threads'
|
30
|
-
end
|
31
|
-
|
32
|
-
def description
|
33
|
-
<<-EOD
|
34
|
-
th[read] l[ist] <thnum>
|
35
|
-
|
36
|
-
#{short_description}
|
37
|
-
EOD
|
38
|
-
end
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -8,13 +8,25 @@ module Byebug
|
|
8
8
|
#
|
9
9
|
# Resumes the specified thread
|
10
10
|
#
|
11
|
-
class
|
11
|
+
class ResumeCommand < Command
|
12
12
|
include Helpers::ThreadHelper
|
13
13
|
|
14
|
-
def regexp
|
14
|
+
def self.regexp
|
15
15
|
/^\s* r(?:esume)? (?: \s* (\d+))? \s*$/x
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.description
|
19
|
+
<<-EOD
|
20
|
+
th[read] r[esume] <thnum>
|
21
|
+
|
22
|
+
#{short_description}
|
23
|
+
EOD
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.short_description
|
27
|
+
'Resumes execution of the specified thread'
|
28
|
+
end
|
29
|
+
|
18
30
|
def execute
|
19
31
|
return puts(help) unless @match[1]
|
20
32
|
|
@@ -28,18 +40,6 @@ module Byebug
|
|
28
40
|
context.resume
|
29
41
|
display_context(context)
|
30
42
|
end
|
31
|
-
|
32
|
-
def short_description
|
33
|
-
'Resumes execution of the specified thread'
|
34
|
-
end
|
35
|
-
|
36
|
-
def description
|
37
|
-
<<-EOD
|
38
|
-
th[read] r[esume] <thnum>
|
39
|
-
|
40
|
-
#{short_description}
|
41
|
-
EOD
|
42
|
-
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -8,13 +8,25 @@ module Byebug
|
|
8
8
|
#
|
9
9
|
# Stops the specified thread
|
10
10
|
#
|
11
|
-
class
|
11
|
+
class StopCommand < Command
|
12
12
|
include Helpers::ThreadHelper
|
13
13
|
|
14
|
-
def regexp
|
14
|
+
def self.regexp
|
15
15
|
/^\s* st(?:op)? (?: \s* (\d+))? \s*$/x
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.description
|
19
|
+
<<-EOD
|
20
|
+
th[read] st[op] <thnum>
|
21
|
+
|
22
|
+
#{short_description}
|
23
|
+
EOD
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.short_description
|
27
|
+
'Stops the execution of the specified thread'
|
28
|
+
end
|
29
|
+
|
18
30
|
def execute
|
19
31
|
return puts(help) unless @match[1]
|
20
32
|
|
@@ -24,18 +36,6 @@ module Byebug
|
|
24
36
|
context.suspend
|
25
37
|
display_context(context)
|
26
38
|
end
|
27
|
-
|
28
|
-
def short_description
|
29
|
-
'Stops the execution of the specified thread'
|
30
|
-
end
|
31
|
-
|
32
|
-
def description
|
33
|
-
<<-EOD
|
34
|
-
th[read] st[op] <thnum>
|
35
|
-
|
36
|
-
#{short_description}
|
37
|
-
EOD
|
38
|
-
end
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -8,13 +8,25 @@ module Byebug
|
|
8
8
|
#
|
9
9
|
# Switches to the specified thread
|
10
10
|
#
|
11
|
-
class
|
11
|
+
class SwitchCommand < Command
|
12
12
|
include Helpers::ThreadHelper
|
13
13
|
|
14
|
-
def regexp
|
14
|
+
def self.regexp
|
15
15
|
/^\s* sw(?:itch)? (?: \s* (\d+))? \s*$/x
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.description
|
19
|
+
<<-EOD
|
20
|
+
th[read] sw[itch] <thnum>
|
21
|
+
|
22
|
+
#{short_description}
|
23
|
+
EOD
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.short_description
|
27
|
+
'Switches execution to the specified thread'
|
28
|
+
end
|
29
|
+
|
18
30
|
def execute
|
19
31
|
return puts(help) unless @match[1]
|
20
32
|
|
@@ -24,19 +36,8 @@ module Byebug
|
|
24
36
|
display_context(context)
|
25
37
|
|
26
38
|
context.switch
|
27
|
-
@state.proceed
|
28
|
-
end
|
29
39
|
|
30
|
-
|
31
|
-
'Switches execution to the specified thread'
|
32
|
-
end
|
33
|
-
|
34
|
-
def description
|
35
|
-
<<-EOD
|
36
|
-
th[read] sw[itch] <thnum>
|
37
|
-
|
38
|
-
#{short_description}
|
39
|
-
EOD
|
40
|
+
processor.proceed!
|
40
41
|
end
|
41
42
|
end
|
42
43
|
end
|