byebug 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/CHANGELOG.md +10 -0
- data/GUIDE.md +235 -9
- data/bin/byebug +12 -16
- data/byebug.gemspec +0 -1
- data/ext/byebug/byebug.c +5 -6
- data/lib/byebug.rb +17 -8
- data/lib/byebug/command.rb +12 -21
- data/lib/byebug/commands/breakpoints.rb +5 -9
- data/lib/byebug/commands/catchpoint.rb +2 -4
- data/lib/byebug/commands/condition.rb +4 -6
- data/lib/byebug/commands/continue.rb +2 -4
- data/lib/byebug/commands/control.rb +2 -4
- data/lib/byebug/commands/display.rb +4 -10
- data/lib/byebug/commands/edit.rb +2 -4
- data/lib/byebug/commands/enable.rb +6 -10
- data/lib/byebug/commands/eval.rb +12 -13
- data/lib/byebug/commands/finish.rb +2 -4
- data/lib/byebug/commands/frame.rb +6 -15
- data/lib/byebug/commands/help.rb +2 -3
- data/lib/byebug/commands/info.rb +5 -7
- data/lib/byebug/commands/jump.rb +2 -4
- data/lib/byebug/commands/kill.rb +2 -4
- data/lib/byebug/commands/list.rb +2 -4
- data/lib/byebug/commands/method.rb +4 -10
- data/lib/byebug/commands/quit.rb +2 -4
- data/lib/byebug/commands/reload.rb +1 -3
- data/lib/byebug/commands/repl.rb +3 -7
- data/lib/byebug/commands/save.rb +2 -4
- data/lib/byebug/commands/set.rb +4 -8
- data/lib/byebug/commands/show.rb +2 -4
- data/lib/byebug/commands/skip.rb +2 -4
- data/lib/byebug/commands/source.rb +1 -3
- data/lib/byebug/commands/stepping.rb +2 -4
- data/lib/byebug/commands/trace.rb +2 -4
- data/lib/byebug/commands/variables.rb +6 -18
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.texi +1 -9
- data/test/breakpoints_test.rb +1 -2
- data/test/examples/info.rb +5 -5
- data/test/examples/list.rb +21 -21
- data/test/examples/reload.rb +5 -5
- data/test/examples/repl.rb +6 -0
- data/test/examples/save.rb +2 -2
- data/test/examples/set.rb +2 -2
- data/test/examples/source.rb +2 -2
- data/test/finish_test.rb +1 -1
- data/test/help_test.rb +31 -15
- data/test/list_test.rb +27 -25
- data/test/reload_test.rb +3 -3
- data/test/repl_test.rb +8 -8
- data/test/set_test.rb +2 -12
- data/test/support/test_dsl.rb +25 -39
- data/test/variables_test.rb +0 -2
- metadata +4 -18
- data/test/examples/irb.rb +0 -6
data/lib/byebug/commands/jump.rb
CHANGED
@@ -48,13 +48,11 @@ module Byebug
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def description
|
51
|
-
%{
|
52
|
-
j[ump] line\tjump to line number (absolute)
|
51
|
+
%{j[ump] line\tjump to line number (absolute)
|
53
52
|
j[ump] -line\tjump back to line (relative)
|
54
53
|
j[ump] +line\tjump ahead to line (relative)
|
55
54
|
|
56
|
-
Change the next line of code to be executed.
|
57
|
-
}
|
55
|
+
Change the next line of code to be executed.}
|
58
56
|
end
|
59
57
|
end
|
60
58
|
end
|
data/lib/byebug/commands/kill.rb
CHANGED
data/lib/byebug/commands/list.rb
CHANGED
@@ -38,13 +38,11 @@ module Byebug
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def description
|
41
|
-
%{
|
42
|
-
l[ist]\t\tlist forward
|
41
|
+
%{l[ist]\t\tlist forward
|
43
42
|
l[ist] -\tlist backward
|
44
43
|
l[ist] =\tlist current line
|
45
44
|
l[ist] nn-mm\tlist given lines
|
46
|
-
* NOTE - to turn on autolist, use 'set autolist'
|
47
|
-
}
|
45
|
+
* NOTE - to turn on autolist, use 'set autolist'}
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
@@ -32,9 +32,7 @@ module Byebug
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def description
|
35
|
-
%{
|
36
|
-
m[ethod] sig[nature] <obj>\tshow the signature of a method
|
37
|
-
}
|
35
|
+
%{m[ethod] sig[nature] <obj>\tshow the signature of a method}
|
38
36
|
end
|
39
37
|
end
|
40
38
|
end if have_methodsig
|
@@ -48,16 +46,14 @@ module Byebug
|
|
48
46
|
end
|
49
47
|
|
50
48
|
def execute
|
49
|
+
obj = debug_eval(@match.post_match)
|
51
50
|
if @match[1] == "iv"
|
52
|
-
obj = debug_eval(@match.post_match)
|
53
51
|
obj.instance_variables.sort.each do |v|
|
54
52
|
print "#{v} = #{obj.instance_variable_get(v).inspect}\n"
|
55
53
|
end
|
56
54
|
elsif @match[1]
|
57
|
-
obj = debug_eval(@match.post_match)
|
58
55
|
print "#{columnize(obj.methods.sort(), Command.settings[:width])}\n"
|
59
56
|
else
|
60
|
-
obj = debug_eval(@match.post_match)
|
61
57
|
return print "Should be Class/Module: #{@match.post_match}\n" unless
|
62
58
|
obj.kind_of? Module
|
63
59
|
print "#{columnize(obj.instance_methods(false).sort(),
|
@@ -71,11 +67,9 @@ module Byebug
|
|
71
67
|
end
|
72
68
|
|
73
69
|
def description
|
74
|
-
%{
|
75
|
-
m[ethod] i[nstance] <obj>\tshow methods of object
|
70
|
+
%{m[ethod] i[nstance] <obj>\tshow methods of object
|
76
71
|
m[ethod] iv <obj>\t\tshow instance variables of object
|
77
|
-
m[ethod] <class|module>\t\tshow instance methods of class or module
|
78
|
-
}
|
72
|
+
m[ethod] <class|module>\t\tshow instance methods of class or module}
|
79
73
|
end
|
80
74
|
end
|
81
75
|
end
|
data/lib/byebug/commands/quit.rb
CHANGED
@@ -25,14 +25,12 @@ module Byebug
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def description
|
28
|
-
%{
|
29
|
-
q[uit][ !| unconditionally]\texit from byebug.
|
28
|
+
%{q[uit][ !| unconditionally]\texit from byebug.
|
30
29
|
exit[!]\talias to quit
|
31
30
|
|
32
31
|
Normally we prompt before exiting. However if the parameter
|
33
32
|
"unconditionally" is given or command is suffixed with !, we exit
|
34
|
-
without asking further questions.
|
35
|
-
}
|
33
|
+
without asking further questions.}
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
data/lib/byebug/commands/repl.rb
CHANGED
@@ -102,14 +102,12 @@ module Byebug
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def description
|
105
|
-
%{
|
106
|
-
irb[ -d]\tstarts an Interactive Ruby (IRB) session.
|
105
|
+
%{irb[ -d]\tstarts an Interactive Ruby (IRB) session.
|
107
106
|
|
108
107
|
If -d is added you can get access to byebug's state via the global
|
109
108
|
variable $byebug_state. IRB is extended with methods "cont", "n" and
|
110
109
|
"step" which run the corresponding byebug commands. In contrast to the
|
111
|
-
real byebug commands these commands don't allow arguments.
|
112
|
-
}
|
110
|
+
real byebug commands these commands don't allow arguments.}
|
113
111
|
end
|
114
112
|
end
|
115
113
|
end
|
@@ -149,9 +147,7 @@ module Byebug
|
|
149
147
|
end
|
150
148
|
|
151
149
|
def description
|
152
|
-
%{
|
153
|
-
pry[ -d]\tstarts a Pry session.
|
154
|
-
}
|
150
|
+
%{pry[ -d]\tstarts a Pry session.}
|
155
151
|
end
|
156
152
|
end
|
157
153
|
end if has_pry
|
data/lib/byebug/commands/save.rb
CHANGED
@@ -77,14 +77,12 @@ module Byebug
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def description
|
80
|
-
%{
|
81
|
-
save[ FILE]
|
80
|
+
%{save[ FILE]
|
82
81
|
|
83
82
|
Saves current byebug state to FILE as a script file. This includes
|
84
83
|
breakpoints, catchpoints, display expressions and some settings. If
|
85
84
|
no filename is given, we will fabricate one.
|
86
|
-
Use the "source" command in another debug session to restore them.
|
87
|
-
}
|
85
|
+
Use the "source" command in another debug session to restore them.}
|
88
86
|
end
|
89
87
|
end
|
90
88
|
end
|
data/lib/byebug/commands/set.rb
CHANGED
@@ -62,7 +62,7 @@ module Byebug
|
|
62
62
|
set_on = true
|
63
63
|
end
|
64
64
|
|
65
|
-
subcmd = find(Subcommands, try_subcmd)
|
65
|
+
subcmd = Command.find(Subcommands, try_subcmd)
|
66
66
|
|
67
67
|
# Subcommand not found...
|
68
68
|
return print "Unknown set command \"#{try_subcmd}\"\n" unless subcmd
|
@@ -114,7 +114,6 @@ module Byebug
|
|
114
114
|
Command.settings[:autoirb] = (set_on ? 1 : 0)
|
115
115
|
when /^testing$/
|
116
116
|
Command.settings[:testing] = set_on
|
117
|
-
Command.settings[:basename] = set_on
|
118
117
|
when /^forcestep$/
|
119
118
|
Command.settings[:force_stepping] = set_on
|
120
119
|
when /^history$/
|
@@ -147,8 +146,7 @@ module Byebug
|
|
147
146
|
return unless listsize
|
148
147
|
self.class.settings[:listsize] = listsize
|
149
148
|
when /^width$/
|
150
|
-
width = get_int(args[0], "Set width", 10, nil, 80)
|
151
|
-
return unless width
|
149
|
+
return unless width = get_int(args[0], "Set width", 10, nil, 80)
|
152
150
|
Command.settings[:width] = width
|
153
151
|
else
|
154
152
|
return print "Unknown setting #{@match[1]}.\n"
|
@@ -162,10 +160,8 @@ module Byebug
|
|
162
160
|
end
|
163
161
|
|
164
162
|
def description
|
165
|
-
%{
|
166
|
-
|
167
|
-
or 0. You can see these environment settings with the "show" command
|
168
|
-
}
|
163
|
+
%{Modifies parts of byebug environment. Boolean values take on, off, 1
|
164
|
+
or 0. You can see these environment settings with the "show" command.}
|
169
165
|
end
|
170
166
|
end
|
171
167
|
|
data/lib/byebug/commands/show.rb
CHANGED
@@ -201,7 +201,7 @@ module Byebug
|
|
201
201
|
|
202
202
|
args = @match[1].split(/[ \t]+/)
|
203
203
|
param = args.shift
|
204
|
-
subcmd = find(Subcommands, param)
|
204
|
+
subcmd = Command.find(Subcommands, param)
|
205
205
|
if subcmd
|
206
206
|
print "%s\n" % show_setting(subcmd.name)
|
207
207
|
else
|
@@ -215,9 +215,7 @@ module Byebug
|
|
215
215
|
end
|
216
216
|
|
217
217
|
def description
|
218
|
-
%{
|
219
|
-
Generic command for showing things about byebug.
|
220
|
-
}
|
218
|
+
%{Generic command for showing things about byebug.}
|
221
219
|
end
|
222
220
|
end
|
223
221
|
|
data/lib/byebug/commands/skip.rb
CHANGED
@@ -22,13 +22,11 @@ module Byebug
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def description
|
25
|
-
%{
|
26
|
-
sk[ip]\tskip the next thrown exception
|
25
|
+
%{sk[ip]\tskip the next thrown exception
|
27
26
|
|
28
27
|
This is useful if you've explicitly caught an exception through the
|
29
28
|
"catch" command, and wish to pass the exception on to the code that
|
30
|
-
|
31
|
-
}
|
29
|
+
you're debugging.}
|
32
30
|
end
|
33
31
|
end
|
34
32
|
end
|
@@ -39,11 +39,9 @@ module Byebug
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def description
|
42
|
-
%{
|
43
|
-
n[ext][+-]?[ nnn]\tstep over once or nnn times,
|
42
|
+
%{n[ext][+-]?[ nnn]\tstep over once or nnn times,
|
44
43
|
\t\t'+' forces to move to another line.
|
45
|
-
\t\t'-' is the opposite of '+' and disables the force_stepping setting.
|
46
|
-
}
|
44
|
+
\t\t'-' is the opposite of '+' and disables the force_stepping setting.}
|
47
45
|
end
|
48
46
|
end
|
49
47
|
end
|
@@ -40,10 +40,8 @@ module Byebug
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def description
|
43
|
-
%{
|
44
|
-
tr[ace] (
|
45
|
-
tr[ace] var(iable) VARNAME [stop|nostop]\tset trace variable on VARNAME
|
46
|
-
}
|
43
|
+
%{tr[ace] (on|off)\tset trace mode
|
44
|
+
tr[ace] var(iable) VARNAME [stop|nostop]\tset trace variable on VARNAME}
|
47
45
|
end
|
48
46
|
end
|
49
47
|
end
|
@@ -46,9 +46,7 @@ module Byebug
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def description
|
49
|
-
%{
|
50
|
-
v[ar] cl[ass] \t\t\tshow class variables of self
|
51
|
-
}
|
49
|
+
%{v[ar] cl[ass] \t\t\tshow class variables of self}
|
52
50
|
end
|
53
51
|
end
|
54
52
|
end
|
@@ -79,9 +77,7 @@ module Byebug
|
|
79
77
|
end
|
80
78
|
|
81
79
|
def description
|
82
|
-
%{
|
83
|
-
v[ar] co[nst] <object>\t\tshow constants of object
|
84
|
-
}
|
80
|
+
%{v[ar] co[nst] <object>\t\tshow constants of object}
|
85
81
|
end
|
86
82
|
end
|
87
83
|
end
|
@@ -101,9 +97,7 @@ module Byebug
|
|
101
97
|
end
|
102
98
|
|
103
99
|
def description
|
104
|
-
%{
|
105
|
-
v[ar] g[lobal]\t\t\tshow global variables
|
106
|
-
}
|
100
|
+
%{v[ar] g[lobal]\t\t\tshow global variables}
|
107
101
|
end
|
108
102
|
end
|
109
103
|
end
|
@@ -124,9 +118,7 @@ module Byebug
|
|
124
118
|
end
|
125
119
|
|
126
120
|
def description
|
127
|
-
%{
|
128
|
-
v[ar] i[nstance] <object>\tshow instance variables of object
|
129
|
-
}
|
121
|
+
%{v[ar] i[nstance] <object>\tshow instance variables of object}
|
130
122
|
end
|
131
123
|
end
|
132
124
|
end
|
@@ -151,9 +143,7 @@ module Byebug
|
|
151
143
|
end
|
152
144
|
|
153
145
|
def description
|
154
|
-
%{
|
155
|
-
v[ar] l[ocal]\t\t\tshow local variables
|
156
|
-
}
|
146
|
+
%{v[ar] l[ocal]\t\t\tshow local variables}
|
157
147
|
end
|
158
148
|
end
|
159
149
|
end
|
@@ -191,9 +181,7 @@ module Byebug
|
|
191
181
|
end
|
192
182
|
|
193
183
|
def description
|
194
|
-
%{
|
195
|
-
v[ar] ct\t\t\tshow class heirarchy of object
|
196
|
-
}
|
184
|
+
%{v[ar] ct\t\t\tshow class heirarchy of object}
|
197
185
|
end
|
198
186
|
end
|
199
187
|
end if have_classtree
|
data/lib/byebug/version.rb
CHANGED
data/old_doc/byebug.texi
CHANGED
@@ -923,7 +923,6 @@ Options:
|
|
923
923
|
--keep-frame-binding Keep frame bindings
|
924
924
|
-m, --post-mortem Activate post-mortem mode
|
925
925
|
--no-quit Do not quit when script finishes
|
926
|
-
--no-rewrite-program Do not set $0 to the program being debugged
|
927
926
|
--no-stop Do not stop when script is loaded
|
928
927
|
-nx Don't run any initialization files like .byebugrc
|
929
928
|
-r, --require SCRIPT Require the library, before executing your script
|
@@ -1023,12 +1022,6 @@ conjunction with @option{--no-stop}. See also @ref{Post-Mortem Debugging}.
|
|
1023
1022
|
@cindex @option{--no-quit}
|
1024
1023
|
Restart byebug when your program terminates normally.
|
1025
1024
|
|
1026
|
-
@item --no-rewrite-program
|
1027
|
-
@cindex @option{--no-rewrite-program}
|
1028
|
-
Normally @code{byebug} will reset the program name @code{$0} from its name to
|
1029
|
-
the debugged program, and set the its name in variable @code{$BYEBUG_SCRIPT}. In
|
1030
|
-
the unlikely even you don't want this use this option.
|
1031
|
-
|
1032
1025
|
@item --no-stop
|
1033
1026
|
@cindex @option{--no-stop}
|
1034
1027
|
Normally the @code{byebug} stops before executing the first statement. If
|
@@ -1100,8 +1093,7 @@ Here are the default values in @code{options}
|
|
1100
1093
|
#<OpenStruct server=false, client=false, frame_bind=false, cport=8990,
|
1101
1094
|
tracing=false, nx=false, post_mortem=false, port=8989,
|
1102
1095
|
verbose_long=false, annotate=nil, control=true, restart_script=nil,
|
1103
|
-
quit=true,
|
1104
|
-
host=nil, wait=false>
|
1096
|
+
quit=true, stop=true, script=nil, host=nil, wait=false>
|
1105
1097
|
@end smallexample
|
1106
1098
|
|
1107
1099
|
@node Command Files
|
data/test/breakpoints_test.rb
CHANGED
@@ -76,9 +76,8 @@ class TestBreakpoints < TestDsl::TestCase
|
|
76
76
|
end
|
77
77
|
|
78
78
|
describe 'show a message' do
|
79
|
-
describe 'with full filename' do
|
80
|
-
temporary_change_hash Byebug::Command.settings, :basename, false
|
81
79
|
|
80
|
+
describe 'with full filename' do
|
82
81
|
it 'must show a message with full filename' do
|
83
82
|
enter 'break 14', 'cont'
|
84
83
|
debug_file('breakpoint1') { @id = Byebug.breakpoints.first.id }
|
data/test/examples/info.rb
CHANGED
data/test/examples/list.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
byebug
|
2
|
-
2
|
3
|
-
3
|
4
|
-
4
|
5
|
-
5
|
6
|
-
6
|
7
|
-
7
|
8
|
-
8
|
9
|
-
9
|
10
|
-
10
|
11
|
-
11
|
12
|
-
12
|
13
|
-
13
|
14
|
-
14
|
15
|
-
15
|
16
|
-
16
|
17
|
-
17
|
18
|
-
18
|
19
|
-
19
|
20
|
-
20
|
21
|
-
21
|
22
|
-
22
|
2
|
+
a = 2
|
3
|
+
a = 3
|
4
|
+
a = 4
|
5
|
+
a = 5
|
6
|
+
a = 6
|
7
|
+
a = 7
|
8
|
+
a = 8
|
9
|
+
a = 9
|
10
|
+
a = 10
|
11
|
+
a = 11
|
12
|
+
a = 12
|
13
|
+
a = 13
|
14
|
+
a = 14
|
15
|
+
a = 15
|
16
|
+
a = 16
|
17
|
+
a = 17
|
18
|
+
a = 18
|
19
|
+
a = 19
|
20
|
+
a = 20
|
21
|
+
a = 21
|
22
|
+
a = 22
|
23
23
|
a = '%23'
|