byebug 1.1.0 → 1.1.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/Rakefile +0 -1
- data/bin/byebug +51 -114
- data/byebug.gemspec +1 -1
- data/ext/byebug/byebug.c +23 -106
- data/ext/byebug/byebug.h +10 -30
- data/ext/byebug/context.c +16 -102
- data/ext/byebug/extconf.rb +0 -9
- data/lib/byebug.rb +8 -122
- data/lib/byebug/command.rb +35 -29
- data/lib/byebug/commands/breakpoints.rb +17 -12
- data/lib/byebug/commands/catchpoint.rb +5 -5
- data/lib/byebug/commands/condition.rb +9 -7
- data/lib/byebug/commands/continue.rb +7 -4
- data/lib/byebug/commands/control.rb +4 -32
- data/lib/byebug/commands/display.rb +15 -14
- data/lib/byebug/commands/edit.rb +14 -13
- data/lib/byebug/commands/enable.rb +33 -35
- data/lib/byebug/commands/eval.rb +22 -29
- data/lib/byebug/commands/finish.rb +11 -9
- data/lib/byebug/commands/frame.rb +24 -50
- data/lib/byebug/commands/help.rb +21 -27
- data/lib/byebug/commands/info.rb +29 -92
- data/lib/byebug/commands/irb.rb +9 -11
- data/lib/byebug/commands/jump.rb +4 -4
- data/lib/byebug/commands/kill.rb +8 -8
- data/lib/byebug/commands/list.rb +2 -2
- data/lib/byebug/commands/method.rb +6 -6
- data/lib/byebug/commands/quit.rb +8 -8
- data/lib/byebug/commands/reload.rb +3 -3
- data/lib/byebug/commands/save.rb +10 -9
- data/lib/byebug/commands/set.rb +29 -26
- data/lib/byebug/commands/show.rb +17 -18
- data/lib/byebug/commands/skip.rb +8 -8
- data/lib/byebug/commands/source.rb +15 -13
- data/lib/byebug/commands/stepping.rb +7 -7
- data/lib/byebug/commands/trace.rb +8 -13
- data/lib/byebug/commands/variables.rb +18 -18
- data/lib/byebug/context.rb +3 -3
- data/lib/byebug/interface.rb +2 -7
- data/lib/byebug/processor.rb +9 -22
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.1 +3 -35
- data/old_doc/byebug.texi +69 -201
- data/old_doc/test-tri2.rb +1 -1
- data/test/breakpoints_test.rb +8 -1
- data/test/frame_test.rb +0 -8
- data/test/help_test.rb +13 -19
- data/test/info_test.rb +8 -32
- data/test/irb_test.rb +3 -4
- data/test/jump_test.rb +4 -4
- data/test/save_test.rb +2 -2
- data/test/set_test.rb +16 -8
- data/test/source_test.rb +10 -1
- data/test/support/context.rb +1 -1
- data/test/support/mocha_extensions.rb +16 -15
- data/test/support/test_dsl.rb +2 -2
- data/test/trace_test.rb +0 -45
- metadata +4 -10
- data/ext/byebug/locker.c +0 -53
- data/lib/byebug/commands/threads.rb +0 -190
- data/test/examples/frame_threads.rb +0 -31
- data/test/examples/info_threads.rb +0 -48
- data/test/examples/thread.rb +0 -32
- data/test/examples/trace_threads.rb +0 -20
data/lib/byebug/command.rb
CHANGED
@@ -13,29 +13,6 @@ module Byebug
|
|
13
13
|
string[Command.settings[:width]-3 .. -1] = "..."
|
14
14
|
end
|
15
15
|
end
|
16
|
-
end
|
17
|
-
|
18
|
-
# Root dir for byebug
|
19
|
-
BYEBUG_DIR = File.expand_path(File.dirname(__FILE__)) unless
|
20
|
-
defined?(BYEBUG_DIR)
|
21
|
-
|
22
|
-
class Command
|
23
|
-
SubcmdStruct = Struct.new(:name, :min, :short_help, :long_help) unless
|
24
|
-
defined?(SubcmdStruct)
|
25
|
-
|
26
|
-
##
|
27
|
-
# Print list of subcmds
|
28
|
-
#
|
29
|
-
def format_subcmds(subcmds)
|
30
|
-
cmd_name = self.class.name[/Byebug::(.*)Command/, 1].downcase
|
31
|
-
s = "\n" \
|
32
|
-
"--\n" \
|
33
|
-
"List of \"#{cmd_name}\" subcommands:\n" \
|
34
|
-
"--\n"
|
35
|
-
for subcmd in subcmds do
|
36
|
-
s += "#{cmd_name} #{subcmd.name} -- #{subcmd.short_help}\n"
|
37
|
-
end
|
38
|
-
end
|
39
16
|
|
40
17
|
##
|
41
18
|
# Find param in subcmds.
|
@@ -54,6 +31,31 @@ module Byebug
|
|
54
31
|
return nil
|
55
32
|
end
|
56
33
|
|
34
|
+
##
|
35
|
+
# Build formatted list of subcmds
|
36
|
+
#
|
37
|
+
def format_subcmds(subcmds)
|
38
|
+
cmd_name = self.class.names.join("|")
|
39
|
+
s = "\n" \
|
40
|
+
"--\n" \
|
41
|
+
"List of \"#{cmd_name}\" subcommands:\n" \
|
42
|
+
"--\n"
|
43
|
+
for subcmd in subcmds do
|
44
|
+
s += "#{cmd_name} #{subcmd.name} -- #{subcmd.short_help}\n"
|
45
|
+
end
|
46
|
+
return s
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
# Root dir for byebug
|
52
|
+
BYEBUG_DIR = File.expand_path(File.dirname(__FILE__)) unless
|
53
|
+
defined?(BYEBUG_DIR)
|
54
|
+
|
55
|
+
class Command
|
56
|
+
SubcmdStruct = Struct.new(:name, :min, :short_help, :long_help) unless
|
57
|
+
defined?(SubcmdStruct)
|
58
|
+
|
57
59
|
class << self
|
58
60
|
def commands
|
59
61
|
@commands ||= []
|
@@ -66,6 +68,13 @@ module Byebug
|
|
66
68
|
unknown: false,
|
67
69
|
need_context: false } unless defined?(DEF_OPTIONS)
|
68
70
|
|
71
|
+
def help(args)
|
72
|
+
output = description.split("\n").map{|l| l.gsub(/^ +/, '')}
|
73
|
+
output.shift if output.first && output.first.empty?
|
74
|
+
output.pop if output.last && output.last.empty?
|
75
|
+
output.join("\n") + "\n"
|
76
|
+
end
|
77
|
+
|
69
78
|
def inherited(klass)
|
70
79
|
DEF_OPTIONS.each do |o, v|
|
71
80
|
klass.options[o] = v if klass.options[o].nil?
|
@@ -140,7 +149,7 @@ module Byebug
|
|
140
149
|
# Register default settings
|
141
150
|
register_setting_var(:basename, false)
|
142
151
|
register_setting_var(:callstyle, :last)
|
143
|
-
register_setting_var(:
|
152
|
+
register_setting_var(:testing, false)
|
144
153
|
register_setting_var(:force_stepping, false)
|
145
154
|
register_setting_var(:full_path, true)
|
146
155
|
register_setting_var(:listsize, 10)
|
@@ -202,11 +211,8 @@ module Byebug
|
|
202
211
|
end
|
203
212
|
|
204
213
|
def get_binding
|
205
|
-
@state.context.frame_binding(@state.frame_pos)
|
206
|
-
|
207
|
-
|
208
|
-
def get_context(thnum)
|
209
|
-
Byebug.contexts.find{|c| c.thnum == thnum}
|
214
|
+
@state.context ? @state.context.frame_binding(@state.frame_pos) :
|
215
|
+
TOPLEVEL_BINDING
|
210
216
|
end
|
211
217
|
end
|
212
218
|
|
@@ -14,6 +14,9 @@ module Byebug
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def execute
|
17
|
+
return print AddBreakpoint.help(nil) if
|
18
|
+
AddBreakpoint.names.include?(@match[0])
|
19
|
+
|
17
20
|
if @match[1]
|
18
21
|
line, _, _, expr = @match.captures
|
19
22
|
else
|
@@ -95,15 +98,16 @@ module Byebug
|
|
95
98
|
end
|
96
99
|
|
97
100
|
class << self
|
98
|
-
def
|
99
|
-
|
101
|
+
def names
|
102
|
+
%w(break)
|
100
103
|
end
|
101
104
|
|
102
|
-
def
|
105
|
+
def description
|
103
106
|
%{
|
104
107
|
b[reak] file:line [if expr]
|
105
108
|
b[reak] class(.|#)method [if expr]
|
106
|
-
|
109
|
+
|
110
|
+
Set breakpoint to some position, (optionally) if expr == true
|
107
111
|
}
|
108
112
|
end
|
109
113
|
end
|
@@ -118,10 +122,7 @@ module Byebug
|
|
118
122
|
end
|
119
123
|
|
120
124
|
def execute
|
121
|
-
unless @state.context
|
122
|
-
errmsg "We are not in a state we can delete breakpoints.\n"
|
123
|
-
return
|
124
|
-
end
|
125
|
+
return errmsg "We are not in a state we can delete breakpoints.\n" unless @state.context
|
125
126
|
brkpts = @match[1]
|
126
127
|
unless brkpts
|
127
128
|
if confirm("Delete all breakpoints? (y or n) ")
|
@@ -139,15 +140,19 @@ module Byebug
|
|
139
140
|
end
|
140
141
|
|
141
142
|
class << self
|
142
|
-
def
|
143
|
-
|
143
|
+
def names
|
144
|
+
%w(delete)
|
144
145
|
end
|
145
146
|
|
146
|
-
def
|
147
|
+
def description
|
147
148
|
%{
|
148
|
-
del[ete][ nnn...]
|
149
|
+
del[ete][ nnn...]
|
150
|
+
|
151
|
+
Without argumen, deletes all breakpoints. With integer numbers,
|
152
|
+
deletes specific breakpoints.
|
149
153
|
}
|
150
154
|
end
|
151
155
|
end
|
152
156
|
end
|
157
|
+
|
153
158
|
end
|
@@ -38,16 +38,16 @@ module Byebug
|
|
38
38
|
end
|
39
39
|
|
40
40
|
class << self
|
41
|
-
def
|
42
|
-
|
41
|
+
def names
|
42
|
+
%w(catch)
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
45
|
+
def description
|
46
46
|
%{
|
47
47
|
cat[ch]\t\tsame as "info catch"
|
48
48
|
cat[ch] <exception-name> [on|off]
|
49
|
-
\tIntercept <exception-name> when there would otherwise be no handler.
|
50
|
-
\tWith an "on" or "off", turn handling the exception on or off.
|
49
|
+
\tIntercept <exception-name> when there would otherwise be no handler.
|
50
|
+
\tWith an "on" or "off", turn handling the exception on or off.
|
51
51
|
cat[ch] off\tdelete all catchpoints
|
52
52
|
}
|
53
53
|
end
|
@@ -31,16 +31,18 @@ module Byebug
|
|
31
31
|
end
|
32
32
|
|
33
33
|
class << self
|
34
|
-
def
|
35
|
-
|
34
|
+
def names
|
35
|
+
%w(condition)
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def description
|
39
39
|
%{
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
cond[ition] nnn[ expr]
|
41
|
+
|
42
|
+
Specify breakpoint number nnn to break only if expr is true. nnn is an
|
43
|
+
integer and expr is an expression to be evaluated whenever breakpoint
|
44
|
+
nnn is reached. If no expression is specified, the condition is
|
45
|
+
removed.
|
44
46
|
}
|
45
47
|
end
|
46
48
|
end
|
@@ -4,6 +4,7 @@ module Byebug
|
|
4
4
|
class ContinueCommand < Command
|
5
5
|
self.allow_in_post_mortem = true
|
6
6
|
self.need_context = false
|
7
|
+
|
7
8
|
def regexp
|
8
9
|
/^\s* c(?:ont(?:inue)?)? (?:\s+(.*))? $/x
|
9
10
|
end
|
@@ -24,13 +25,15 @@ module Byebug
|
|
24
25
|
end
|
25
26
|
|
26
27
|
class << self
|
27
|
-
def
|
28
|
-
|
28
|
+
def names
|
29
|
+
%w(continue)
|
29
30
|
end
|
30
31
|
|
31
|
-
def
|
32
|
+
def description
|
32
33
|
%{
|
33
|
-
c[ont[inue]][ nnn]
|
34
|
+
c[ont[inue]][ nnn]
|
35
|
+
|
36
|
+
Run until program ends, hits a breakpoint or reaches line nnn
|
34
37
|
}
|
35
38
|
end
|
36
39
|
end
|
@@ -55,13 +55,14 @@ module Byebug
|
|
55
55
|
end
|
56
56
|
|
57
57
|
class << self
|
58
|
-
def
|
59
|
-
|
58
|
+
def names
|
59
|
+
%w(restart)
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
62
|
+
def description
|
63
63
|
%{
|
64
64
|
restart|R [args]
|
65
|
+
|
65
66
|
Restart the program. This is a re-exec - all byebug state
|
66
67
|
is lost. If command arguments are passed those are used.
|
67
68
|
}
|
@@ -69,33 +70,4 @@ module Byebug
|
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
72
|
-
class InterruptCommand < Command
|
73
|
-
self.allow_in_control = true
|
74
|
-
self.allow_in_post_mortem = false
|
75
|
-
self.event = false
|
76
|
-
self.need_context = true
|
77
|
-
|
78
|
-
def regexp
|
79
|
-
/^\s*i(?:nterrupt)?\s*$/
|
80
|
-
end
|
81
|
-
|
82
|
-
def execute
|
83
|
-
unless Byebug.interrupt_last
|
84
|
-
context = Byebug.thread_context(Thread.main)
|
85
|
-
context.interrupt
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
class << self
|
90
|
-
def help_command
|
91
|
-
'interrupt'
|
92
|
-
end
|
93
|
-
|
94
|
-
def help(cmd)
|
95
|
-
%{
|
96
|
-
i[nterrupt]\tinterrupt the program
|
97
|
-
}
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
73
|
end
|
@@ -34,11 +34,11 @@ module Byebug
|
|
34
34
|
end
|
35
35
|
|
36
36
|
class << self
|
37
|
-
def
|
38
|
-
|
37
|
+
def names
|
38
|
+
%w(display)
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def description
|
42
42
|
%{
|
43
43
|
disp[lay] <expression>\tadd expression into display expression list
|
44
44
|
}
|
@@ -65,11 +65,11 @@ module Byebug
|
|
65
65
|
end
|
66
66
|
|
67
67
|
class << self
|
68
|
-
def
|
69
|
-
|
68
|
+
def names
|
69
|
+
%w(display)
|
70
70
|
end
|
71
71
|
|
72
|
-
def
|
72
|
+
def description
|
73
73
|
%{
|
74
74
|
disp[lay]\t\tdisplay expression list
|
75
75
|
}
|
@@ -101,18 +101,19 @@ module Byebug
|
|
101
101
|
end
|
102
102
|
|
103
103
|
class << self
|
104
|
-
def
|
105
|
-
|
104
|
+
def names
|
105
|
+
%w(undisplay)
|
106
106
|
end
|
107
107
|
|
108
|
-
def
|
108
|
+
def description
|
109
109
|
%{
|
110
110
|
undisp[lay][ nnn]
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
Do "info display" to see
|
111
|
+
|
112
|
+
Cancel some expressions to be displayed when program stops. Arguments
|
113
|
+
are the code numbers of the expressions to stop displaying. No
|
114
|
+
argument means cancel all automatic-display expressions. "delete
|
115
|
+
display" has the same effect as this command. Do "info display" to see
|
116
|
+
the current list of code numbers.
|
116
117
|
}
|
117
118
|
end
|
118
119
|
end
|
data/lib/byebug/commands/edit.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
module Byebug
|
2
|
-
|
2
|
+
|
3
|
+
class Edit < Command
|
3
4
|
self.allow_in_control = true
|
5
|
+
|
4
6
|
def regexp
|
5
7
|
/^\s* ed(?:it)? (?:\s+(.*))?$/ix
|
6
8
|
end
|
7
|
-
|
9
|
+
|
8
10
|
def execute
|
9
11
|
if not @match[1] or @match[1].strip.empty?
|
10
12
|
unless @state.context
|
11
13
|
errmsg "We are not in a state that has an associated file.\n"
|
12
|
-
return
|
14
|
+
return
|
13
15
|
end
|
14
16
|
file = @state.file
|
15
17
|
line_number = @state.line
|
@@ -26,23 +28,22 @@ module Byebug
|
|
26
28
|
errmsg "File \"#{file}\" is not readable.\n"
|
27
29
|
end
|
28
30
|
end
|
29
|
-
|
31
|
+
|
30
32
|
class << self
|
31
|
-
def
|
32
|
-
|
33
|
+
def names
|
34
|
+
%w(edit)
|
33
35
|
end
|
34
36
|
|
35
|
-
def
|
37
|
+
def description
|
36
38
|
%{
|
37
|
-
|
39
|
+
edit[ file:lineno]\tEdit specified file.
|
38
40
|
|
39
|
-
With no argument, edits file containing most recent line listed.
|
40
|
-
Editing targets can also be specified
|
41
|
-
|
41
|
+
With no argument, edits file containing most recent line listed.
|
42
|
+
Editing targets can also be specified to start editing at a specific
|
43
|
+
line in a specific file.
|
42
44
|
}
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
|
-
|
48
|
-
end # module Byebug
|
49
|
+
end
|
@@ -42,7 +42,6 @@ module Byebug
|
|
42
42
|
@state.display[pos-1][0] = ('Enable' == is_enable)
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
46
45
|
end
|
47
46
|
|
48
47
|
class EnableCommand < Command
|
@@ -88,28 +87,27 @@ module Byebug
|
|
88
87
|
enable_disable_display('Enable', args)
|
89
88
|
end
|
90
89
|
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
def help
|
91
|
+
if args[1]
|
92
|
+
subcmd = find(Subcommands, args[1])
|
93
|
+
return "Invalid \"enable\" subcommand \"#{args[1]}\"." unless subcmd
|
94
|
+
str = subcmd.short_help + '.'
|
95
|
+
str += '\n' + subcmd.long_help if subcmd.long_help
|
96
|
+
return str
|
94
97
|
end
|
98
|
+
EnableCommand.description + format_subcmds(Subcommands)
|
99
|
+
end
|
95
100
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
return "Invalid \"enable\" subcommand \"#{args[1]}\"." unless subcmd
|
101
|
-
|
102
|
-
str = subcmd.short_help + '.'
|
103
|
-
str += '\n' + subcmd.long_help if subcmd.long_help
|
104
|
-
return str
|
105
|
-
end
|
101
|
+
class << self
|
102
|
+
def names
|
103
|
+
%w(enable)
|
104
|
+
end
|
106
105
|
|
107
|
-
|
108
|
-
|
106
|
+
def description
|
107
|
+
%{
|
109
108
|
Enable some things.
|
110
109
|
This is used to cancel the effect of the "disable" command.
|
111
110
|
}
|
112
|
-
str += format_subcmds(Subcommands)
|
113
111
|
end
|
114
112
|
end
|
115
113
|
end
|
@@ -156,32 +154,32 @@ module Byebug
|
|
156
154
|
enable_disable_display('Disable', args)
|
157
155
|
end
|
158
156
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
157
|
+
def help(args)
|
158
|
+
if args[1]
|
159
|
+
subcmd = find(Subcommands, args[1])
|
160
|
+
return "Invalid \"disable\" subcommand \"#{args[1]}\"." unless subcmd
|
163
161
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
162
|
+
str = subcmd.short_help + '.'
|
163
|
+
str += '\n' + subcmd.long_help if subcmd.long_help
|
164
|
+
return str
|
165
|
+
end
|
166
|
+
DisableCommand.description + format_subcmds(Subcommads)
|
167
|
+
end
|
169
168
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
169
|
+
class << self
|
170
|
+
def names
|
171
|
+
%w(disable)
|
172
|
+
end
|
174
173
|
|
175
|
-
|
176
|
-
|
174
|
+
def description
|
175
|
+
%{
|
177
176
|
Disable some things.
|
178
177
|
|
179
178
|
A disabled item is not forgotten, but has no effect until reenabled.
|
180
179
|
Use the "enable" command to have it take effect again.
|
181
|
-
|
182
|
-
str += format_subcmds(Subcommads)
|
180
|
+
}
|
183
181
|
end
|
184
182
|
end
|
185
183
|
end
|
186
184
|
|
187
|
-
end
|
185
|
+
end
|