byebug 4.0.5 → 5.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 +72 -34
- data/CONTRIBUTING.md +26 -31
- data/README.md +3 -3
- data/lib/byebug/breakpoint.rb +2 -1
- data/lib/byebug/command.rb +27 -49
- data/lib/byebug/commands/break.rb +21 -15
- data/lib/byebug/commands/catch.rb +9 -15
- data/lib/byebug/commands/condition.rb +12 -15
- data/lib/byebug/commands/continue.rb +8 -11
- data/lib/byebug/commands/delete.rb +9 -12
- data/lib/byebug/commands/disable.rb +32 -0
- data/lib/byebug/commands/disable/breakpoints.rb +38 -0
- data/lib/byebug/commands/disable/display.rb +39 -0
- data/lib/byebug/commands/display.rb +18 -51
- data/lib/byebug/commands/down.rb +39 -0
- data/lib/byebug/commands/edit.rb +8 -14
- data/lib/byebug/commands/enable.rb +25 -0
- data/lib/byebug/commands/enable/breakpoints.rb +38 -0
- data/lib/byebug/commands/enable/display.rb +39 -0
- data/lib/byebug/commands/eval.rb +10 -192
- data/lib/byebug/commands/finish.rb +11 -12
- data/lib/byebug/commands/frame.rb +17 -182
- data/lib/byebug/commands/help.rb +18 -18
- data/lib/byebug/commands/history.rb +9 -10
- data/lib/byebug/commands/info.rb +17 -190
- data/lib/byebug/commands/info/args.rb +39 -0
- data/lib/byebug/commands/info/breakpoints.rb +59 -0
- data/lib/byebug/commands/info/catch.rb +39 -0
- data/lib/byebug/commands/info/display.rb +42 -0
- data/lib/byebug/commands/info/file.rb +81 -0
- data/lib/byebug/commands/info/line.rb +31 -0
- data/lib/byebug/commands/info/program.rb +51 -0
- data/lib/byebug/commands/interrupt.rb +5 -9
- data/lib/byebug/commands/irb.rb +5 -9
- data/lib/byebug/commands/kill.rb +6 -12
- data/lib/byebug/commands/list.rb +47 -19
- data/lib/byebug/commands/method.rb +8 -14
- data/lib/byebug/commands/next.rb +36 -0
- data/lib/byebug/commands/pp.rb +41 -0
- data/lib/byebug/commands/pry.rb +5 -9
- data/lib/byebug/commands/ps.rb +44 -0
- data/lib/byebug/commands/putl.rb +43 -0
- data/lib/byebug/commands/quit.rb +8 -12
- data/lib/byebug/commands/restart.rb +6 -12
- data/lib/byebug/commands/save.rb +30 -39
- data/lib/byebug/commands/set.rb +19 -21
- data/lib/byebug/commands/show.rb +10 -16
- data/lib/byebug/commands/source.rb +6 -12
- data/lib/byebug/commands/step.rb +36 -0
- data/lib/byebug/commands/thread.rb +13 -130
- data/lib/byebug/commands/thread/current.rb +35 -0
- data/lib/byebug/commands/thread/list.rb +41 -0
- data/lib/byebug/commands/thread/resume.rb +45 -0
- data/lib/byebug/commands/thread/stop.rb +41 -0
- data/lib/byebug/commands/thread/switch.rb +43 -0
- data/lib/byebug/commands/tracevar.rb +8 -14
- data/lib/byebug/commands/undisplay.rb +12 -15
- data/lib/byebug/commands/untracevar.rb +5 -11
- data/lib/byebug/commands/up.rb +39 -0
- data/lib/byebug/commands/var.rb +15 -94
- data/lib/byebug/commands/var/all.rb +37 -0
- data/lib/byebug/commands/var/const.rb +38 -0
- data/lib/byebug/commands/var/global.rb +33 -0
- data/lib/byebug/commands/var/instance.rb +35 -0
- data/lib/byebug/commands/var/local.rb +35 -0
- data/lib/byebug/commands/where.rb +47 -0
- data/lib/byebug/core.rb +10 -0
- data/lib/byebug/helpers/eval.rb +47 -0
- data/lib/byebug/helpers/file.rb +46 -0
- data/lib/byebug/helpers/frame.rb +76 -0
- data/lib/byebug/helpers/parse.rb +74 -0
- data/lib/byebug/helpers/string.rb +24 -0
- data/lib/byebug/helpers/thread.rb +53 -0
- data/lib/byebug/helpers/toggle.rb +56 -0
- data/lib/byebug/helpers/var.rb +45 -0
- data/lib/byebug/history.rb +2 -4
- data/lib/byebug/interface.rb +5 -3
- data/lib/byebug/interfaces/local_interface.rb +3 -1
- data/lib/byebug/interfaces/remote_interface.rb +3 -1
- data/lib/byebug/interfaces/test_interface.rb +6 -2
- data/lib/byebug/printers/plain.rb +1 -1
- data/lib/byebug/processors/command_processor.rb +9 -11
- data/lib/byebug/processors/control_command_processor.rb +1 -1
- data/lib/byebug/remote.rb +3 -0
- data/lib/byebug/runner.rb +5 -3
- data/lib/byebug/setting.rb +2 -18
- data/lib/byebug/settings/savefile.rb +21 -0
- data/lib/byebug/states/regular_state.rb +15 -6
- data/lib/byebug/subcommand_list.rb +33 -0
- data/lib/byebug/subcommands.rb +53 -0
- data/lib/byebug/version.rb +1 -1
- metadata +45 -6
- data/lib/byebug/commands/enable_disable.rb +0 -132
- data/lib/byebug/commands/stepping.rb +0 -75
- data/lib/byebug/helper.rb +0 -131
@@ -42,21 +42,15 @@ module Byebug
|
|
42
42
|
errmsg pr('catch.errors.off', off: cmd)
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
"catch" lists catchpoints.
|
55
|
-
"catch off" deletes all catchpoints.
|
56
|
-
"catch <exception>" enables handling <exception>.
|
57
|
-
"catch <exception> off" disables handling <exception>.
|
58
|
-
EOD
|
59
|
-
end
|
45
|
+
def description
|
46
|
+
<<-EOD
|
47
|
+
cat[ch][ (off|<exception>[ off])]
|
48
|
+
|
49
|
+
"catch" lists catchpoints.
|
50
|
+
"catch off" deletes all catchpoints.
|
51
|
+
"catch <exception>" enables handling <exception>.
|
52
|
+
"catch <exception> off" disables handling <exception>.
|
53
|
+
EOD
|
60
54
|
end
|
61
55
|
end
|
62
56
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'byebug/command'
|
2
|
+
require 'byebug/helpers/parse'
|
2
3
|
|
3
4
|
module Byebug
|
4
5
|
#
|
@@ -7,6 +8,8 @@ module Byebug
|
|
7
8
|
# Adds the ability to stop on breakpoints only under certain conditions.
|
8
9
|
#
|
9
10
|
class ConditionCommand < Command
|
11
|
+
include Helpers::ParseHelper
|
12
|
+
|
10
13
|
self.allow_in_post_mortem = false
|
11
14
|
|
12
15
|
def regexp
|
@@ -14,7 +17,7 @@ module Byebug
|
|
14
17
|
end
|
15
18
|
|
16
19
|
def execute
|
17
|
-
return puts(
|
20
|
+
return puts(help) unless @match[1]
|
18
21
|
|
19
22
|
breakpoints = Byebug.breakpoints.sort_by(&:id)
|
20
23
|
return errmsg(pr('condition.errors.no_breakpoints')) if breakpoints.empty?
|
@@ -32,21 +35,15 @@ module Byebug
|
|
32
35
|
breakpoint.expr = @match[2]
|
33
36
|
end
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
def description
|
41
|
-
prettify <<-EOD
|
42
|
-
cond[ition] <n>[ expr]
|
38
|
+
def description
|
39
|
+
<<-EOD
|
40
|
+
cond[ition] <n>[ expr]
|
43
41
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
42
|
+
Specify breakpoint number <n> to break only if <expr> is true. <n> is
|
43
|
+
an integer and <expr> is an expression to be evaluated whenever
|
44
|
+
breakpoint <n> is reached. If no expression is specified, the condition
|
45
|
+
is removed.
|
46
|
+
EOD
|
50
47
|
end
|
51
48
|
end
|
52
49
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'byebug/command'
|
2
|
+
require 'byebug/helpers/parse'
|
2
3
|
|
3
4
|
module Byebug
|
4
5
|
#
|
@@ -8,6 +9,8 @@ module Byebug
|
|
8
9
|
# specific line number or until program termination.
|
9
10
|
#
|
10
11
|
class ContinueCommand < Command
|
12
|
+
include Helpers::ParseHelper
|
13
|
+
|
11
14
|
def regexp
|
12
15
|
/^\s* c(?:ont(?:inue)?)? (?:\s+(\S+))? \s*$/x
|
13
16
|
end
|
@@ -28,18 +31,12 @@ module Byebug
|
|
28
31
|
@state.proceed
|
29
32
|
end
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
def description
|
37
|
-
prettify <<-EOD
|
38
|
-
c[ont[inue]][ <n>]
|
34
|
+
def description
|
35
|
+
<<-EOD
|
36
|
+
c[ont[inue]][ <n>]
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
end
|
38
|
+
Run until program ends, hits a breakpoint or reaches line <n>.
|
39
|
+
EOD
|
43
40
|
end
|
44
41
|
end
|
45
42
|
end
|
@@ -1,10 +1,13 @@
|
|
1
1
|
require 'byebug/command'
|
2
|
+
require 'byebug/helpers/parse'
|
2
3
|
|
3
4
|
module Byebug
|
4
5
|
#
|
5
6
|
# Implements breakpoint deletion.
|
6
7
|
#
|
7
8
|
class DeleteCommand < Command
|
9
|
+
include Helpers::ParseHelper
|
10
|
+
|
8
11
|
self.allow_in_post_mortem = false
|
9
12
|
self.allow_in_control = true
|
10
13
|
|
@@ -32,19 +35,13 @@ module Byebug
|
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
def description
|
41
|
-
prettify <<-EOD
|
42
|
-
del[ete][ nnn...]
|
38
|
+
def description
|
39
|
+
<<-EOD
|
40
|
+
del[ete][ nnn...]
|
43
41
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
42
|
+
Without and argument, deletes all breakpoints. With integer arguments,
|
43
|
+
it deletes specific breakpoints.
|
44
|
+
EOD
|
48
45
|
end
|
49
46
|
end
|
50
47
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'byebug/subcommands'
|
2
|
+
|
3
|
+
require 'byebug/commands/disable/breakpoints'
|
4
|
+
require 'byebug/commands/disable/display'
|
5
|
+
|
6
|
+
module Byebug
|
7
|
+
#
|
8
|
+
# Disabling custom display expressions or breakpoints.
|
9
|
+
#
|
10
|
+
class DisableCommand < Command
|
11
|
+
include Subcommands
|
12
|
+
|
13
|
+
def regexp
|
14
|
+
/^\s* dis(?:able)? (?:\s+ (.+))? \s*$/x
|
15
|
+
end
|
16
|
+
|
17
|
+
def description
|
18
|
+
<<-EOD
|
19
|
+
dis[able][[ breakpoints| display)][ n1[ n2[ ...[ nn]]]]]
|
20
|
+
|
21
|
+
Disables breakpoints or displays.
|
22
|
+
|
23
|
+
"disable" by itself shows this help
|
24
|
+
"disable breakpoints" disables all breakpoints.
|
25
|
+
"disable displays" disables all displays.
|
26
|
+
|
27
|
+
You can also specify a space separated list of breakpoint or display
|
28
|
+
numbers to disable only specific breakpoints or displays.
|
29
|
+
EOD
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'byebug/helpers/toggle'
|
2
|
+
|
3
|
+
module Byebug
|
4
|
+
#
|
5
|
+
# Reopens the +disable+ command to define the +breakpoints+ subcommand
|
6
|
+
#
|
7
|
+
class DisableCommand < Command
|
8
|
+
#
|
9
|
+
# Disables all or specific breakpoints
|
10
|
+
#
|
11
|
+
class BreakpointsSubcommand < Command
|
12
|
+
include Helpers::ToggleHelper
|
13
|
+
|
14
|
+
def regexp
|
15
|
+
/^\s* b(?:reakpoints)? (?:\s+ (.+))? \s*$/x
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute
|
19
|
+
enable_disable_breakpoints('disable', @match[1])
|
20
|
+
end
|
21
|
+
|
22
|
+
def short_description
|
23
|
+
'Disable all or specific breakpoints.'
|
24
|
+
end
|
25
|
+
|
26
|
+
def description
|
27
|
+
<<-EOD
|
28
|
+
dis[able] b[reakpoints][ <id1> <id2> .. <idn>]
|
29
|
+
|
30
|
+
#{short_description}
|
31
|
+
|
32
|
+
Give breakpoint numbers (separated by spaces) as arguments or no
|
33
|
+
argument at all if you want to disable every breakpoint.
|
34
|
+
EOD
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'byebug/helpers/toggle'
|
2
|
+
|
3
|
+
module Byebug
|
4
|
+
#
|
5
|
+
# Reopens the +disable+ command to define the +display+ subcommand
|
6
|
+
#
|
7
|
+
class DisableCommand < Command
|
8
|
+
#
|
9
|
+
# Enables all or specific displays
|
10
|
+
#
|
11
|
+
class DisplaySubcommand < Command
|
12
|
+
include Helpers::ToggleHelper
|
13
|
+
|
14
|
+
def regexp
|
15
|
+
/^\s* d(?:isplay)? (?:\s+ (.+))? \s*$/x
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute
|
19
|
+
enable_disable_display('disable', @match[1])
|
20
|
+
end
|
21
|
+
|
22
|
+
def short_description
|
23
|
+
'Disables expressions to be displayed when program stops.'
|
24
|
+
end
|
25
|
+
|
26
|
+
def description
|
27
|
+
<<-EOD
|
28
|
+
dis[able] d[isplay][ <id1> <id2> .. <idn>]
|
29
|
+
|
30
|
+
#{short_description}
|
31
|
+
|
32
|
+
Arguments are the code numbers of the expressions to disable. Do "info
|
33
|
+
display" to see the current list of code numbers. If no arguments are
|
34
|
+
specified, all displays are disabled.
|
35
|
+
EOD
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -2,34 +2,33 @@ require 'byebug/command'
|
|
2
2
|
|
3
3
|
module Byebug
|
4
4
|
#
|
5
|
-
#
|
6
|
-
# every time the debugger stops.
|
5
|
+
# Custom expressions to be displayed every time the debugger stops.
|
7
6
|
#
|
8
|
-
class
|
7
|
+
class DisplayCommand < Command
|
9
8
|
self.allow_in_post_mortem = false
|
10
9
|
|
10
|
+
def self.always_run
|
11
|
+
2
|
12
|
+
end
|
13
|
+
|
11
14
|
def regexp
|
12
|
-
/^\s* disp(?:lay)?
|
15
|
+
/^\s* disp(?:lay)? (?:\s+ (.+))? \s*$/x
|
13
16
|
end
|
14
17
|
|
15
18
|
def execute
|
16
|
-
|
17
|
-
@state.display.push [true, exp]
|
18
|
-
display_expression(exp)
|
19
|
-
end
|
19
|
+
return print_display_expressions unless @match && @match[1]
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
21
|
+
@state.display.push [true, @match[1]]
|
22
|
+
display_expression(@match[1])
|
23
|
+
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
def description
|
26
|
+
<<-EOD
|
27
|
+
disp[lay][ <expression>]
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
If <expression> specified, adds <expression> into display expression
|
30
|
+
list. Otherwise, it lists all expressions.
|
31
|
+
EOD
|
33
32
|
end
|
34
33
|
|
35
34
|
private
|
@@ -40,39 +39,6 @@ module Byebug
|
|
40
39
|
exp: exp,
|
41
40
|
result: bb_warning_eval(exp).inspect)
|
42
41
|
end
|
43
|
-
end
|
44
|
-
|
45
|
-
#
|
46
|
-
# Displays the value of enabled expressions.
|
47
|
-
#
|
48
|
-
class DisplayCommand < Command
|
49
|
-
self.allow_in_post_mortem = false
|
50
|
-
|
51
|
-
def self.always_run
|
52
|
-
2
|
53
|
-
end
|
54
|
-
|
55
|
-
def regexp
|
56
|
-
/^\s* disp(?:lay)? \s*$/x
|
57
|
-
end
|
58
|
-
|
59
|
-
def execute
|
60
|
-
print_display_expressions
|
61
|
-
end
|
62
|
-
|
63
|
-
class << self
|
64
|
-
def names
|
65
|
-
%w(display)
|
66
|
-
end
|
67
|
-
|
68
|
-
def description
|
69
|
-
prettify <<-EOD
|
70
|
-
disp[lay] Display expression list.
|
71
|
-
EOD
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
76
42
|
|
77
43
|
def print_display_expressions
|
78
44
|
result = prc('display.result', @state.display) do |item, index|
|
@@ -83,6 +49,7 @@ module Byebug
|
|
83
49
|
result: bb_warning_eval(expression).inspect }
|
84
50
|
end
|
85
51
|
end
|
52
|
+
|
86
53
|
print result
|
87
54
|
end
|
88
55
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
require 'byebug/command'
|
5
|
+
require 'byebug/helpers/frame'
|
6
|
+
require 'byebug/helpers/parse'
|
7
|
+
|
8
|
+
module Byebug
|
9
|
+
#
|
10
|
+
# Move the current frame down in the backtrace.
|
11
|
+
#
|
12
|
+
class DownCommand < Command
|
13
|
+
include Helpers::FrameHelper
|
14
|
+
include Helpers::ParseHelper
|
15
|
+
|
16
|
+
def regexp
|
17
|
+
/^\s* down (?:\s+(\S+))? \s*$/x
|
18
|
+
end
|
19
|
+
|
20
|
+
def execute
|
21
|
+
pos, err = parse_steps(@match[1], 'Down')
|
22
|
+
return errmsg(err) unless pos
|
23
|
+
|
24
|
+
adjust_frame(-pos, false)
|
25
|
+
|
26
|
+
ListCommand.new(@state).execute if Setting[:autolist]
|
27
|
+
end
|
28
|
+
|
29
|
+
def description
|
30
|
+
<<-EOD
|
31
|
+
down[ count]
|
32
|
+
|
33
|
+
Move to a lower frame in the stack trace.
|
34
|
+
|
35
|
+
Use the "bt" command to find out where you want to go.
|
36
|
+
EOD
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/byebug/commands/edit.rb
CHANGED
@@ -37,20 +37,14 @@ module Byebug
|
|
37
37
|
system(cmd)
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
With no argument, edits file containing most recent line listed.
|
50
|
-
Editing targets can also be specified to start editing at a specific
|
51
|
-
line in a specific file.
|
52
|
-
EOD
|
53
|
-
end
|
40
|
+
def description
|
41
|
+
<<-EOD
|
42
|
+
edit[ file:lineno] Edit specified files.
|
43
|
+
|
44
|
+
With no argument, edits file containing most recent line listed. Editing
|
45
|
+
targets can also be specified to start editing at a specific line in a
|
46
|
+
specific file.
|
47
|
+
EOD
|
54
48
|
end
|
55
49
|
end
|
56
50
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'byebug/subcommands'
|
2
|
+
|
3
|
+
require 'byebug/commands/enable/breakpoints'
|
4
|
+
require 'byebug/commands/enable/display'
|
5
|
+
|
6
|
+
module Byebug
|
7
|
+
#
|
8
|
+
# Enabling custom display expressions or breakpoints.
|
9
|
+
#
|
10
|
+
class EnableCommand < Command
|
11
|
+
include Subcommands
|
12
|
+
|
13
|
+
def regexp
|
14
|
+
/^\s* en(?:able)? (?:\s+ (.+))? \s*$/x
|
15
|
+
end
|
16
|
+
|
17
|
+
def description
|
18
|
+
<<-EOD
|
19
|
+
en[able][[ b[reakpoints]| d[isplay])][ n1[ n2[ ...[ nn]]]]]
|
20
|
+
|
21
|
+
Enables breakpoints or displays.
|
22
|
+
EOD
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|