byebug 1.0.3 → 1.1.0
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 +5 -0
- data/README.md +13 -11
- data/Rakefile +0 -6
- data/bin/byebug +83 -136
- data/ext/byebug/byebug.c +182 -96
- data/ext/byebug/byebug.h +5 -7
- data/ext/byebug/context.c +52 -40
- data/lib/byebug.rb +81 -81
- data/lib/byebug/command.rb +18 -35
- data/lib/byebug/commands/control.rb +1 -1
- data/lib/byebug/commands/display.rb +0 -2
- data/lib/byebug/commands/enable.rb +4 -16
- data/lib/byebug/commands/eval.rb +5 -3
- data/lib/byebug/commands/frame.rb +68 -69
- data/lib/byebug/commands/help.rb +2 -1
- data/lib/byebug/commands/info.rb +43 -42
- data/lib/byebug/commands/method.rb +4 -3
- data/lib/byebug/commands/set.rb +10 -19
- data/lib/byebug/commands/show.rb +6 -13
- data/lib/byebug/interface.rb +1 -1
- data/lib/byebug/processor.rb +14 -17
- data/lib/byebug/version.rb +1 -2
- data/old_doc/byebug.texi +576 -847
- data/test/breakpoints_test.rb +0 -1
- data/test/conditions_test.rb +35 -33
- data/test/display_test.rb +14 -13
- data/test/edit_test.rb +28 -25
- data/test/eval_test.rb +0 -2
- data/test/finish_test.rb +4 -3
- data/test/frame_test.rb +20 -21
- data/test/help_test.rb +26 -23
- data/test/info_test.rb +105 -108
- data/test/irb_test.rb +26 -25
- data/test/kill_test.rb +19 -19
- data/test/list_test.rb +140 -156
- data/test/method_test.rb +21 -22
- data/test/post_mortem_test.rb +2 -5
- data/test/quit_test.rb +16 -17
- data/test/reload_test.rb +2 -2
- data/test/restart_test.rb +0 -1
- data/test/save_test.rb +31 -32
- data/test/set_test.rb +50 -47
- data/test/show_test.rb +67 -66
- data/test/source_test.rb +31 -34
- data/test/stepping_test.rb +32 -34
- data/test/support/test_dsl.rb +1 -1
- data/test/trace_test.rb +1 -2
- data/test/variables_test.rb +36 -34
- metadata +2 -4
- data/lib/byebug/commands/tmate.rb +0 -36
- data/test/tmate_test.rb +0 -44
@@ -41,6 +41,8 @@ module Byebug
|
|
41
41
|
|
42
42
|
# Implements byebug's 'method' command.
|
43
43
|
class MethodCommand < Command
|
44
|
+
include Columnize
|
45
|
+
|
44
46
|
def regexp
|
45
47
|
/^\s*m(?:ethod)?\s+((iv)|(i(:?nstance)?)\s+)?/
|
46
48
|
end
|
@@ -53,15 +55,14 @@ module Byebug
|
|
53
55
|
end
|
54
56
|
elsif @match[1]
|
55
57
|
obj = debug_eval(@match.post_match)
|
56
|
-
print "%s\n", columnize(obj.methods.sort(),
|
57
|
-
self.class.settings[:width])
|
58
|
+
print "%s\n", columnize(obj.methods.sort(), Command.settings[:width])
|
58
59
|
else
|
59
60
|
obj = debug_eval(@match.post_match)
|
60
61
|
unless obj.kind_of? Module
|
61
62
|
print "Should be Class/Module: %s\n", @match.post_match
|
62
63
|
else
|
63
64
|
print "%s\n", columnize(obj.instance_methods(false).sort(),
|
64
|
-
|
65
|
+
Command.settings[:width])
|
65
66
|
end
|
66
67
|
end
|
67
68
|
end
|
data/lib/byebug/commands/set.rb
CHANGED
@@ -47,7 +47,7 @@ module Byebug
|
|
47
47
|
|
48
48
|
def execute
|
49
49
|
# "Set" alone just prints subcommands
|
50
|
-
return
|
50
|
+
return print format_subcmds(Subcommands) unless @match[1]
|
51
51
|
|
52
52
|
args = @match[1].split(/[ \t]+/)
|
53
53
|
try_subcmd = args.shift
|
@@ -94,7 +94,7 @@ module Byebug
|
|
94
94
|
Command.settings[:callstyle] = arg
|
95
95
|
else
|
96
96
|
print "Invalid call style #{arg}. Should be one of: " \
|
97
|
-
"
|
97
|
+
"\"short\", \"last\" or \"tracked\".\n"
|
98
98
|
end
|
99
99
|
end
|
100
100
|
when /^trace$/
|
@@ -126,10 +126,10 @@ module Byebug
|
|
126
126
|
File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", args[1])
|
127
127
|
else
|
128
128
|
print "Invalid history parameter #{args[0]}. Should be " \
|
129
|
-
"
|
129
|
+
"\"filename\", \"save\" or \"size\".\n"
|
130
130
|
end
|
131
131
|
else
|
132
|
-
print
|
132
|
+
print 'Need two parameters for "set history"; got ' \
|
133
133
|
"#{args.size}.\n"
|
134
134
|
return
|
135
135
|
end
|
@@ -144,7 +144,7 @@ module Byebug
|
|
144
144
|
when /^width$/
|
145
145
|
width = get_int(args[0], "Set width", 10, nil, 80)
|
146
146
|
return unless width
|
147
|
-
|
147
|
+
Command.settings[:width] = width
|
148
148
|
ENV['COLUMNS'] = width.to_s
|
149
149
|
else
|
150
150
|
return print "Unknown setting #{@match[1]}.\n"
|
@@ -164,24 +164,15 @@ module Byebug
|
|
164
164
|
return "Invalid \"set\" subcommand \"#{args[1]}\"." unless subcmd
|
165
165
|
|
166
166
|
str = subcmd.short_help + '.'
|
167
|
-
str += "\n" + subcmd.long_help if subcmd.long_help
|
168
|
-
return str
|
167
|
+
return str += "\n" + subcmd.long_help if subcmd.long_help
|
169
168
|
end
|
170
169
|
|
171
170
|
# general help
|
172
|
-
|
173
|
-
Modifies parts of byebug environment. Boolean values take
|
174
|
-
|
175
|
-
You can see these environment settings with the \"show\" command.
|
176
|
-
|
177
|
-
--
|
178
|
-
List of set subcommands:
|
179
|
-
--
|
171
|
+
str = %{
|
172
|
+
Modifies parts of byebug environment. Boolean values take on, off, 1
|
173
|
+
or 0. You can see these environment settings with the "show" command.
|
180
174
|
}
|
181
|
-
|
182
|
-
s += "set #{subcmd.name} -- #{subcmd.short_help}\n"
|
183
|
-
end
|
184
|
-
return s
|
175
|
+
str += format_subcmds(Subcommands)
|
185
176
|
end
|
186
177
|
end
|
187
178
|
end
|
data/lib/byebug/commands/show.rb
CHANGED
@@ -118,7 +118,7 @@ module Byebug
|
|
118
118
|
end
|
119
119
|
return s.join("\n")
|
120
120
|
when /^linetrace$/
|
121
|
-
on_off = Byebug.tracing
|
121
|
+
on_off = Byebug.tracing?
|
122
122
|
return "line tracing is #{show_onoff(on_off)}."
|
123
123
|
when /^linetrace\+$/
|
124
124
|
on_off = Command.settings[:tracing_plus]
|
@@ -138,7 +138,7 @@ module Byebug
|
|
138
138
|
when /^version$/
|
139
139
|
return "byebug #{Byebug::VERSION}"
|
140
140
|
when /^width$/
|
141
|
-
return "width is #{
|
141
|
+
return "width is #{Command.settings[:width]}."
|
142
142
|
else
|
143
143
|
return "Unknown show subcommand #{setting_name}."
|
144
144
|
end
|
@@ -202,7 +202,7 @@ module Byebug
|
|
202
202
|
|
203
203
|
def execute
|
204
204
|
if not @match[1]
|
205
|
-
|
205
|
+
print format_subcmds(Subcommands)
|
206
206
|
else
|
207
207
|
args = @match[1].split(/[ \t]+/)
|
208
208
|
param = args.shift
|
@@ -232,17 +232,10 @@ module Byebug
|
|
232
232
|
end
|
233
233
|
|
234
234
|
# general help
|
235
|
-
s =
|
235
|
+
s = %{
|
236
236
|
Generic command for showing things about byebug.
|
237
|
-
|
238
|
-
|
239
|
-
List of show subcommands:
|
240
|
-
--
|
241
|
-
"
|
242
|
-
for subcmd in Subcommands do
|
243
|
-
s += "show #{subcmd.name} -- #{subcmd.short_help}\n"
|
244
|
-
end
|
245
|
-
return s
|
237
|
+
}
|
238
|
+
s += format_subcmds(Subcommands)
|
246
239
|
end
|
247
240
|
end
|
248
241
|
end
|
data/lib/byebug/interface.rb
CHANGED
data/lib/byebug/processor.rb
CHANGED
@@ -52,12 +52,12 @@ module Byebug
|
|
52
52
|
@display = []
|
53
53
|
|
54
54
|
@mutex = Mutex.new
|
55
|
-
@last_cmd
|
55
|
+
@last_cmd = nil
|
56
56
|
@last_file = nil # Filename the last time we stopped
|
57
57
|
@last_line = nil # line number the last time we stopped
|
58
58
|
@byebug_breakpoints_were_empty = false # Show breakpoints 1st time
|
59
|
-
@byebug_displays_were_empty
|
60
|
-
@byebug_context_was_dead
|
59
|
+
@byebug_displays_were_empty = true # No display 1st time
|
60
|
+
@byebug_context_was_dead = true # Assume we haven't started.
|
61
61
|
end
|
62
62
|
|
63
63
|
def interface=(interface)
|
@@ -197,13 +197,12 @@ module Byebug
|
|
197
197
|
end if context.dead?
|
198
198
|
|
199
199
|
state = State.new do |s|
|
200
|
-
s.context
|
201
|
-
s.file
|
202
|
-
s.line
|
203
|
-
s.
|
204
|
-
s.display = display
|
200
|
+
s.context = context
|
201
|
+
s.file = file
|
202
|
+
s.line = line
|
203
|
+
s.display = display
|
205
204
|
s.interface = interface
|
206
|
-
s.commands
|
205
|
+
s.commands = event_cmds
|
207
206
|
end
|
208
207
|
@interface.state = state if @interface.respond_to?('state=')
|
209
208
|
|
@@ -293,14 +292,12 @@ module Byebug
|
|
293
292
|
|
294
293
|
def preloop(commands, context)
|
295
294
|
aprint('stopped') if Byebug.annotate.to_i > 2
|
296
|
-
if context.dead?
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
print "The program finished.\n"
|
301
|
-
end
|
302
|
-
@byebug_context_was_dead = true
|
295
|
+
if context.dead? and not @byebug_context_was_dead
|
296
|
+
if Byebug.annotate.to_i > 2
|
297
|
+
aprint('exited')
|
298
|
+
print "The program finished.\n"
|
303
299
|
end
|
300
|
+
@byebug_context_was_dead = true
|
304
301
|
end
|
305
302
|
|
306
303
|
if Byebug.annotate.to_i > 2
|
@@ -359,7 +356,7 @@ module Byebug
|
|
359
356
|
end
|
360
357
|
|
361
358
|
class State
|
362
|
-
attr_accessor :
|
359
|
+
attr_accessor :commands, :context, :display, :file
|
363
360
|
attr_accessor :frame_pos, :interface, :line, :previous_line
|
364
361
|
|
365
362
|
def initialize
|
data/lib/byebug/version.rb
CHANGED
data/old_doc/byebug.texi
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
\input texinfo @c -*-texinfo-*-
|
2
2
|
@setfilename byebug.info
|
3
3
|
|
4
|
-
@set DBG byebug
|
5
|
-
@set ttbyebug @code{byebug}
|
6
|
-
@set ttDBG @code{@value{DBG}}
|
7
|
-
|
8
4
|
@set txicodequoteundirected
|
9
5
|
@set txicodequotebacktick
|
10
|
-
@set BYEBUG_VERSION 1.0.
|
11
|
-
@set EDITION 1.0.
|
6
|
+
@set BYEBUG_VERSION 1.0.3
|
7
|
+
@set EDITION 1.0.3
|
12
8
|
@set UPDATED April-2013
|
13
9
|
|
14
10
|
@macro Example {}
|
@@ -25,14 +21,6 @@
|
|
25
21
|
@end smallexample
|
26
22
|
@end macro
|
27
23
|
|
28
|
-
@macro DBG {}
|
29
|
-
@value{DBG}
|
30
|
-
@end macro
|
31
|
-
|
32
|
-
@macro ttDBG {}
|
33
|
-
@value{ttbyebug}
|
34
|
-
@end macro
|
35
|
-
|
36
24
|
@c How to show optional variables.
|
37
25
|
@macro ovar{varname}
|
38
26
|
@r{[}@var{\varname\}@r{]}
|
@@ -87,7 +75,7 @@ This is the @value{EDITION} Edition, @value{UPDATED}
|
|
87
75
|
* Byebug Module and Class:: Byebug's module and class
|
88
76
|
|
89
77
|
Appendix
|
90
|
-
*
|
78
|
+
* Contributing::
|
91
79
|
|
92
80
|
Indexes
|
93
81
|
* Class Module Method Index:: An item for each Class, Module and Method.
|
@@ -102,11 +90,11 @@ Indexes
|
|
102
90
|
@node Summary
|
103
91
|
@chapter Summary of @code{byebug}
|
104
92
|
|
105
|
-
The purpose of a debugger such as @
|
106
|
-
``inside'' a Ruby program while it executes.
|
93
|
+
The purpose of a debugger such as @code{byebug} is to allow you to see what is
|
94
|
+
going on ``inside'' a Ruby program while it executes.
|
107
95
|
|
108
|
-
@
|
109
|
-
to help you catch bugs in the act:
|
96
|
+
@code{byebug} can do four main kinds of things (plus other things in support of
|
97
|
+
these) to help you catch bugs in the act:
|
110
98
|
|
111
99
|
@itemize @bullet
|
112
100
|
@item
|
@@ -119,48 +107,47 @@ Make your script stop on specified conditions.
|
|
119
107
|
Examine what has happened, when your script has stopped.
|
120
108
|
|
121
109
|
@item
|
122
|
-
Change things in your script, so you can experiment with correcting the effects
|
123
|
-
one bug and go on to learn about another.
|
110
|
+
Change things in your script, so you can experiment with correcting the effects
|
111
|
+
of one bug and go on to learn about another.
|
124
112
|
@end itemize
|
125
113
|
|
126
114
|
Although you can use @value{byebug} to invoke your Ruby programs via a debugger
|
127
115
|
at the outset, there are other ways to use and enter the debugger.
|
128
116
|
|
129
117
|
@menu
|
130
|
-
* First Sample Session::
|
131
|
-
* Second Sample Session::
|
132
|
-
* Unit Testing Session::
|
133
|
-
* Byebug.start with a block::
|
134
|
-
* Debugging Oddities::
|
118
|
+
* First Sample Session:: A Simple Sample @code{byebug} session
|
119
|
+
* Second Sample Session:: Second Session. Delving a little deeper
|
120
|
+
* Unit Testing Session:: Using byebug in unit testing
|
121
|
+
* Byebug.start with a block:: Using the Byebug.start with a block
|
122
|
+
* Debugging Oddities:: How debugging Ruby may be different...
|
135
123
|
@end menu
|
136
124
|
|
137
125
|
@node First Sample Session
|
138
|
-
@section The First Sample @code{byebug} Session (@code{list}, @code{display},
|
126
|
+
@section The First Sample @code{byebug} Session (@code{list}, @code{display},
|
127
|
+
@code{print}, and @code{quit})
|
139
128
|
|
140
|
-
You can use this manual at your leisure to read all about @
|
141
|
-
However, a handful of commands are enough to get started using
|
142
|
-
|
129
|
+
You can use this manual at your leisure to read all about @code{byebug}.
|
130
|
+
However, a handful of commands are enough to get started using byebug. The
|
131
|
+
following sections illustrates these commands.
|
143
132
|
|
144
133
|
@iftex
|
145
|
-
In this sample session, we emphasize user input like this: @b{input},
|
146
|
-
|
134
|
+
In this sample session, we emphasize user input like this: @b{input}, to make it
|
135
|
+
easier to pick out from the surrounding output.
|
147
136
|
@end iftex
|
148
137
|
|
149
|
-
Below is Ruby code to compute a triangle number of a given
|
150
|
-
|
151
|
-
such as:
|
138
|
+
Below is Ruby code to compute a triangle number of a given length.
|
139
|
+
@footnote{There are of course shorter ways to define @code{triangle} such as:
|
152
140
|
@smallexample
|
153
141
|
def triangle(n) (n * (n+1)) / 2 end
|
154
142
|
@end smallexample
|
155
|
-
The code we use in this example and the next is more for pedagogical
|
156
|
-
|
157
|
-
|
143
|
+
The code we use in this example and the next is more for pedagogical purposes
|
144
|
+
than how to write short Ruby code.}
|
158
145
|
|
159
146
|
@smallexample
|
160
147
|
$ @b{byebug triangle.rb}
|
161
148
|
triangle.rb:4 def hanoi(n,a,b,c)
|
162
149
|
(byebug:1) @b{list}
|
163
|
-
[
|
150
|
+
[1, 8] in ./triangle.rb
|
164
151
|
1 #!/usr/bin/env ruby
|
165
152
|
2 # Compute the n'th triangle number - the hard way
|
166
153
|
3 # triangle(n) == (n * (n+1)) / 2
|
@@ -170,7 +157,7 @@ triangle.rb:4 def hanoi(n,a,b,c)
|
|
170
157
|
7 tri += i
|
171
158
|
8 end
|
172
159
|
(byebug:1) @b{l}
|
173
|
-
[9,
|
160
|
+
[9, 13] in ./triangle.rb
|
174
161
|
9 tri
|
175
162
|
10 end
|
176
163
|
11
|
@@ -199,22 +186,22 @@ triangle.rb:4 def hanoi(n,a,b,c)
|
|
199
186
|
There are lots of command options, but we don't need them for now. See
|
200
187
|
@ref{byebug command-line options} for a full list of command options.
|
201
188
|
|
202
|
-
Position information consists of a filename and line number, e.g
|
203
|
-
|
204
|
-
of the program; this is line 4 of @code{triangle.rb}. If you are used to
|
205
|
-
dynamic languages and have used debuggers for more statically compiled
|
206
|
-
like C, C++, or Java, it may seem odd to be stopped before a function
|
207
|
-
but in Ruby line 4 is executed, the name @code{triangle} (probably)
|
208
|
-
exist so issuing a method call of @code{triangle} will raise a
|
209
|
-
found'' error.
|
210
|
-
|
211
|
-
@
|
212
|
-
Here it is 1 which is usually the case for the main thread. If the
|
213
|
-
died and you are in post-mortem debugging, there is no thread
|
214
|
-
situation, the string @code{post-mortem} is used in place of a
|
215
|
-
the program has terminated normally, the string this position
|
216
|
-
@code{ctrl}. The commands which are available change depending on the
|
217
|
-
state.
|
189
|
+
Position information consists of a filename and line number, e.g.
|
190
|
+
@:@code{triangle.rb:4}. We are currently stopped before the first executable
|
191
|
+
line of the program; this is line 4 of @code{triangle.rb}. If you are used to
|
192
|
+
less dynamic languages and have used debuggers for more statically compiled
|
193
|
+
languages like C, C++, or Java, it may seem odd to be stopped before a function
|
194
|
+
definition but in Ruby line 4 is executed, the name @code{triangle} (probably)
|
195
|
+
does not exist so issuing a method call of @code{triangle} will raise a
|
196
|
+
``method not found'' error.
|
197
|
+
|
198
|
+
@code{byebug}'s prompt is @code{(byebug:@emph{n})}. The @emph{n} is the thread
|
199
|
+
number. Here it is 1 which is usually the case for the main thread. If the
|
200
|
+
program has died and you are in post-mortem debugging, there is no thread
|
201
|
+
number. In this situation, the string @code{post-mortem} is used in place of a
|
202
|
+
thread number. If the program has terminated normally, the string this position
|
203
|
+
will be @code{ctrl}. The commands which are available change depending on the
|
204
|
+
program state.
|
218
205
|
|
219
206
|
The first command, @code{list} (@pxref{List}), prints 10 lines centered around
|
220
207
|
the current line; the current line here is line 4 and is marked by @code{=>}, so
|
@@ -249,29 +236,26 @@ triangle.rb:6
|
|
249
236
|
0
|
250
237
|
@end smallexample
|
251
238
|
|
252
|
-
The first @kbd{step} command (@pxref{Step}) runs the script one
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
One way to print the values of variables uses @code{p}. (Of course,
|
258
|
-
there are of course lots of other ways too.). When we look at the
|
259
|
-
value of @code{tri} the first time, we see it is @code{nil}. Again we
|
260
|
-
are stopped @emph{before} the assignment on line 5, and this variable
|
261
|
-
hasn't been set previously. However after issuing another ``step''
|
262
|
-
command we see that the value is 0 as expected.
|
239
|
+
The first @kbd{step} command (@pxref{Step}) runs the script one executable unit.
|
240
|
+
The second command we entered was just hitting the return key; @code{byebug}
|
241
|
+
remembers the last command you entered was @code{step}, so it runs that last
|
242
|
+
command again.
|
263
243
|
|
264
|
-
|
265
|
-
|
266
|
-
|
244
|
+
One way to print the values of variables uses @code{p} (of course, there are
|
245
|
+
lots of other ways). When we look at the value of @code{tri} the first time, we
|
246
|
+
see it is @code{nil}. Again we are stopped @emph{before} the assignment on line
|
247
|
+
5, and this variable hasn't been set previously. However after issuing another
|
248
|
+
@code{step} command we see that the value is 0 as expected. If every time we
|
249
|
+
stop we want to see the value of @code{tri} to see how things are going, there
|
250
|
+
is a better way by setting a display expression (@pxref{DisplayCommands}).
|
267
251
|
|
268
252
|
@smallexample
|
269
253
|
(byebug:1) @b{display tri}
|
270
254
|
1: tri = 0
|
271
255
|
@end smallexample
|
272
256
|
|
273
|
-
Now let us run the program until we return from the function.
|
274
|
-
|
257
|
+
Now let us run the program until we return from the function. We'll want to see
|
258
|
+
which lines get run.
|
275
259
|
|
276
260
|
@smallexample
|
277
261
|
(byebug:1) @b{display i}
|
@@ -306,9 +290,9 @@ puts t
|
|
306
290
|
Really quit? (y/n) @b{y}
|
307
291
|
@end smallexample
|
308
292
|
|
309
|
-
So far, so good.
|
310
|
-
issue a @code{quit} command
|
311
|
-
want to quit without being prompted, suffix the command with an exclamation
|
293
|
+
So far, so good. As you can see from the above to get out of @code{byebug}, one
|
294
|
+
can issue a @code{quit} command (@code{q} and @code{exit} are just as good). If
|
295
|
+
you want to quit without being prompted, suffix the command with an exclamation
|
312
296
|
mark, e.g.\@code{q!}.
|
313
297
|
|
314
298
|
@node Second Sample Session
|
@@ -927,29 +911,24 @@ To be continued...
|
|
927
911
|
* Calling from Program:: Calling byebug from inside your program
|
928
912
|
@end menu
|
929
913
|
|
930
|
-
It is also possible to enter byebug when you have an uncaught
|
931
|
-
|
914
|
+
It is also possible to enter byebug when you have an uncaught exception (see
|
915
|
+
@ref{Post-Mortem Debugging}).
|
932
916
|
|
933
917
|
@node Starting byebug
|
934
918
|
@section Starting byebug
|
935
919
|
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
A wrapper shell script called @code{byebug} basically @code{require}'s
|
941
|
-
the gem package @code{byebug} and then loads @code{byebug}.
|
920
|
+
Probably the most familiar thing to do is invoke byebug from a command line. A
|
921
|
+
wrapper shell script called @code{byebug} basically @code{require}'s the gem
|
922
|
+
package @code{byebug} and then loads @code{byebug}.
|
942
923
|
|
943
924
|
@smallexample
|
944
925
|
byebug [byebug-options] [--] @var{ruby-script} @var{ruby-script-arguments...}
|
945
926
|
@end smallexample
|
946
927
|
|
947
|
-
If you don't need to pass dash options to your program which might get
|
948
|
-
|
949
|
-
@option{--}.
|
928
|
+
If you don't need to pass dash options to your program which might get confused
|
929
|
+
with byebug options, then you don't need to add the @option{--}.
|
950
930
|
|
951
|
-
To get a brief list of options and descriptions, use the @code{--help}
|
952
|
-
option.
|
931
|
+
To get a brief list of options and descriptions, use the @code{--help} option.
|
953
932
|
|
954
933
|
@smallexample
|
955
934
|
$ @b{byebug --help}
|
@@ -997,42 +976,39 @@ Options for the @code{byebug} are shown in the following list.
|
|
997
976
|
@node byebug command-line options
|
998
977
|
@subsection Options you can pass to byebug
|
999
978
|
|
1000
|
-
You can run @
|
1001
|
-
program that interacts directly with the program in the same process
|
1002
|
-
|
1003
|
-
different computer.
|
979
|
+
You can run @code{byebug} in various alternative modes, for example, as a
|
980
|
+
program that interacts directly with the program in the same process on the same
|
981
|
+
computer or via a socket to another process possibly on a different computer.
|
1004
982
|
|
1005
|
-
Many options appear as a long option name, such as @option{--help}, and
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
option the double dash can be omitted.
|
983
|
+
Many options appear as a long option name, such as @option{--help}, and a short
|
984
|
+
one letter option name, such as @option{-h}. A double dash (@option{--} is used
|
985
|
+
to separate options which go to @code{byebug} from options that are intended to
|
986
|
+
go to your Ruby script. Options (if any) to @code{byebug} should come first. If
|
987
|
+
there is no possibility of the Ruby script to be debugged getting confused with
|
988
|
+
@code{byebug}'s option, the double dash can be omitted.
|
1012
989
|
|
1013
990
|
@table @code
|
1014
991
|
@item --help
|
1015
992
|
@cindex @option{-h}
|
1016
993
|
@cindex @option{--help}
|
1017
|
-
This option causes @
|
994
|
+
This option causes @code{byebug} to print some basic help and exit.
|
1018
995
|
|
1019
996
|
@item -v | --version
|
1020
997
|
@cindex @option{-v}
|
1021
|
-
This option causes @
|
998
|
+
This option causes @code{byebug} to print its version number and exit.
|
1022
999
|
|
1023
1000
|
@item -A | --annotate @var{level}
|
1024
1001
|
@cindex @option{-A}
|
1025
1002
|
@cindex @option{--annotation} @var{level}
|
1026
1003
|
Set gdb-style annotation @var{level}, a number. Additional information is output
|
1027
|
-
automatically when program state is changed. This can be used by
|
1028
|
-
|
1029
|
-
|
1004
|
+
automatically when program state is changed. This can be used by front-ends such
|
1005
|
+
as GNU Emacs to post this updated information without having to poll for it.
|
1006
|
+
|
1030
1007
|
@item -c | --client
|
1031
1008
|
@cindex @option{-c}
|
1032
1009
|
@cindex @option{--client}
|
1033
|
-
Connect to remote byebug. The remote byebug should have been set
|
1034
|
-
|
1035
|
-
will terminate.
|
1010
|
+
Connect to remote byebug. The remote byebug should have been set up previously
|
1011
|
+
or you will get a connection error and @code{byebug} will terminate.
|
1036
1012
|
|
1037
1013
|
@item --cport @var{port}
|
1038
1014
|
@cindex @option{--cport} @var{port}
|
@@ -1040,21 +1016,7 @@ Port used for control commands.
|
|
1040
1016
|
|
1041
1017
|
@item --debug
|
1042
1018
|
@cindex @option{--debug}
|
1043
|
-
Set @code{$DEBUG} to @code{true}. This option is compatible with
|
1044
|
-
Ruby's.
|
1045
|
-
|
1046
|
-
@item --emacs
|
1047
|
-
Activates GNU Emacs mode.
|
1048
|
-
@c @pxref{GNU Emacs}.
|
1049
|
-
Byebug output is tagged in such a way to allow GNU Emacs to track
|
1050
|
-
where you are in the code.
|
1051
|
-
|
1052
|
-
@item --emacs-basic
|
1053
|
-
Activates full GNU Emacs mode.
|
1054
|
-
@c (@pxref{GNU Emacs}).
|
1055
|
-
This is the equivalent of setting the options @option{--emacs-basic},
|
1056
|
-
@code{annotate=3}, @option{--no-stop}, @option{-no-control} and
|
1057
|
-
@option{--post-mortem}.
|
1019
|
+
Set @code{$DEBUG} to @code{true}. This option is compatible with Ruby's.
|
1058
1020
|
|
1059
1021
|
@item -h | --host @var{host-address}
|
1060
1022
|
Connect host address for remote debugging.
|
@@ -1066,43 +1028,37 @@ Add @var{PATH} to @code{$LOAD_PATH}
|
|
1066
1028
|
|
1067
1029
|
@item --keep-frame-binding
|
1068
1030
|
@cindex @option{--keep-frame-binding}
|
1069
|
-
Bindings are used to set the proper environment in evaluating
|
1070
|
-
|
1071
|
-
believe most people will ever need this option.
|
1072
|
-
|
1073
|
-
By default, byebug doesn't create binding object for each frame
|
1074
|
-
when the frame is created, i.e. when a call is performed. Creating a
|
1075
|
-
binding is an expensive operation and has been a major source of
|
1076
|
-
performance problems.
|
1077
|
-
|
1078
|
-
Instead, byebug creates a binding when there is a need to
|
1079
|
-
evaluate expressions. The artificial binding that is created might be
|
1080
|
-
different from the real one. In particular, in performing constant
|
1081
|
-
and module name resolution.
|
1082
|
-
|
1083
|
-
However it's still possible to restore the old, slower behavior by
|
1084
|
-
using this option or by setting @code{Byebug.keep_frame_binding =
|
1085
|
-
true}. There are two possibilities for which you might want to use
|
1031
|
+
Bindings are used to set the proper environment in evaluating expressions inside
|
1032
|
+
byebug. Under normal circumstances, I don't believe most people will ever need
|
1086
1033
|
this option.
|
1087
1034
|
|
1088
|
-
|
1089
|
-
|
1035
|
+
By default, byebug doesn't create a binding object for each frame when the frame
|
1036
|
+
is created, i.e. when a call is performed. Creating a binding is an expensive
|
1037
|
+
operation and has been a major source of performance problems.
|
1090
1038
|
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1039
|
+
Instead, byebug creates a binding when there is a need to evaluate expressions.
|
1040
|
+
The artificial binding that is created might be different from the real one. In
|
1041
|
+
particular, in performing constant and module name resolution.
|
1042
|
+
|
1043
|
+
However it's still possible to restore the old, slower behavior by using this
|
1044
|
+
option or by setting @code{Byebug.keep_frame_binding = true}. There are two
|
1045
|
+
possibilities for which you might want to use this option.
|
1046
|
+
|
1047
|
+
First, if you think there's a bug in the evaluation of variables, you might want
|
1048
|
+
to set this to see if this corrects things.
|
1049
|
+
|
1050
|
+
Second, since the internal structures that are used here @code{FRAME} and
|
1051
|
+
@code{SCOPE} are not part of the Ruby specification, it is possible they can
|
1052
|
+
change with newer releases; so here this option this may offer a remedy. (But
|
1053
|
+
you'll probably also have to hack the C code since it's likely under this
|
1054
|
+
scenario that byebug will no longer compile.)
|
1098
1055
|
|
1099
1056
|
@item -m | --post-mortem
|
1100
1057
|
@cindex @option{-m}
|
1101
1058
|
@cindex @option{--post-mortem}
|
1102
|
-
If your program raises an exception that isn't caught you can enter
|
1103
|
-
|
1104
|
-
|
1105
|
-
@ref{Post-Mortem Debugging}.
|
1059
|
+
If your program raises an exception that isn't caught you can enter byebug for
|
1060
|
+
inspection of what went wrong. You may also want to use this option in
|
1061
|
+
conjunction with @option{--no-stop}. See also @ref{Post-Mortem Debugging}.
|
1106
1062
|
|
1107
1063
|
@item --no-control
|
1108
1064
|
@cindex @option{--no-control}
|
@@ -1120,9 +1076,9 @@ the unlikely even you don't want this use this option.
|
|
1120
1076
|
|
1121
1077
|
@item --no-stop
|
1122
1078
|
@cindex @option{--no-stop}
|
1123
|
-
Normally the @code{byebug} stops before executing the first
|
1124
|
-
|
1125
|
-
|
1079
|
+
Normally the @code{byebug} stops before executing the first statement. If
|
1080
|
+
instead you want it to start running initially and will perhaps break it later
|
1081
|
+
in the running, use this options.
|
1126
1082
|
|
1127
1083
|
@item -p | --port @var{port}
|
1128
1084
|
@cindex @option{-p} @var{port}
|
@@ -1132,27 +1088,27 @@ Port used for remote debugging.
|
|
1132
1088
|
@item -r | --require @var{library}
|
1133
1089
|
@cindex @option{-r}
|
1134
1090
|
@cindex @option{--require}
|
1135
|
-
Require the library, before executing your script. However if the
|
1136
|
-
|
1137
|
-
|
1091
|
+
Require the library, before executing your script. However if the library
|
1092
|
+
happened to be @code{debug}, we'll just ignore the require (since we're already
|
1093
|
+
a debugger). This option is compatible with Ruby's.
|
1138
1094
|
|
1139
1095
|
@item --script @var{file}
|
1140
1096
|
@cindex @option{--script}
|
1141
|
-
Require the library, before executing your script. However if the
|
1142
|
-
|
1143
|
-
|
1097
|
+
Require the library, before executing your script. However if the library
|
1098
|
+
happend to be @code{debug}, we'll just ignore the require (since we're already a
|
1099
|
+
debugger). This option is compatible with Ruby's.
|
1144
1100
|
|
1145
1101
|
@item -s | --server
|
1146
1102
|
@cindex @option{-s}
|
1147
1103
|
@cindex @option{--server}
|
1148
|
-
Debug the program but listen for remote connections on the default
|
1149
|
-
|
1104
|
+
Debug the program but listen for remote connections on the default port or port
|
1105
|
+
set up via the @option{--port} option. See also @option{--wait}.
|
1150
1106
|
|
1151
1107
|
@item -w | --wait
|
1152
1108
|
@cindex @option{-w}
|
1153
1109
|
@cindex @option{--wait}
|
1154
|
-
Debug the program but stop waiting for a client connection first. This
|
1155
|
-
|
1110
|
+
Debug the program but stop waiting for a client connection first. This option
|
1111
|
+
automatically sets @option{--server} option.
|
1156
1112
|
|
1157
1113
|
@item -x | --trace
|
1158
1114
|
@cindex @option{-x}
|
@@ -1160,8 +1116,9 @@ option automatically sets @option{--server} option.
|
|
1160
1116
|
Turn on line tracing. Running @command{byebug --trace @emph{rubyscript.rb}}
|
1161
1117
|
is much like running: @command{ruby -rtracer @emph{rubyscript.rb}}
|
1162
1118
|
|
1163
|
-
If all you want to do however is get a linetrace, @code{tracer}
|
1119
|
+
If all you want to do however is get a linetrace, @code{tracer} and not
|
1164
1120
|
@code{byebug}, may be faster:
|
1121
|
+
|
1165
1122
|
@smallexample
|
1166
1123
|
$ @b{time ruby -rtracer gcd.rb 34 21 > /dev/null}
|
1167
1124
|
|
@@ -1175,27 +1132,24 @@ user 0m0.448s
|
|
1175
1132
|
sys 0m0.056s
|
1176
1133
|
$
|
1177
1134
|
@end smallexample
|
1178
|
-
|
1179
1135
|
@end table
|
1180
1136
|
|
1181
1137
|
@node byebug default options
|
1182
1138
|
@subsection How to Set Default Command-Line Options
|
1183
1139
|
|
1184
|
-
@
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
can put Ruby code here and set variable @code{options} which is an
|
1193
|
-
OpenStruct. For example here's how you'd set @option{-no-quit} and
|
1140
|
+
@code{byebug} has many command-line options; it seems that some people want to
|
1141
|
+
set them differently from the defaults. For example, some people may want
|
1142
|
+
@option{--no-quit --no-control} to be the default behavior. One could write a
|
1143
|
+
wrapper script or set a shell alias to handle this. But @code{byebug} has
|
1144
|
+
another way to do this. Before processing command options, if the file
|
1145
|
+
@code{$HOME/.rdboptrc} is found, it is loaded. If you want to set the defaults
|
1146
|
+
in some other way, you can put Ruby code here and set variable @code{options}
|
1147
|
+
which is an OpenStruct. For example here's how you'd set @option{-no-quit} and
|
1194
1148
|
change the default control port to 5000.
|
1195
1149
|
|
1196
1150
|
@smallexample
|
1197
|
-
# This file contains how you want the default options to byebug
|
1198
|
-
#
|
1151
|
+
# This file contains how you want the default options to byebug to be set. Any
|
1152
|
+
# Ruby code can be put here.
|
1199
1153
|
#
|
1200
1154
|
# byebug # Uncomment if you want to debug byebug!
|
1201
1155
|
options.control = false
|
@@ -1205,137 +1159,124 @@ puts "rocky's rdboptrc run"
|
|
1205
1159
|
|
1206
1160
|
Here are the default values in @code{options}
|
1207
1161
|
@smallexample
|
1208
|
-
#<OpenStruct server=false, client=false, frame_bind=false, cport=8990,
|
1162
|
+
#<OpenStruct server=false, client=false, frame_bind=false, cport=8990,
|
1163
|
+
tracing=false, nx=false, post_mortem=false, port=8989,
|
1164
|
+
verbose_long=false, annotate=nil, control=true, restart_script=nil,
|
1165
|
+
quit=true, no_rewrite_program=false, stop=true, script=nil,
|
1166
|
+
host=nil, wait=false>
|
1209
1167
|
@end smallexample
|
1210
1168
|
|
1211
|
-
|
1212
1169
|
@node Command Files
|
1213
1170
|
@section Command files
|
1214
1171
|
|
1215
1172
|
@cindex command files
|
1216
|
-
A command file
|
1217
|
-
|
1218
|
-
|
1219
|
-
the
|
1173
|
+
A command file is a file of lines that are @code{byebug} commands. Comments
|
1174
|
+
(lines starting with @kbd{#}) may also be included. An empty line in a command
|
1175
|
+
file does nothing; it does not mean to repeat the last command, as it would from
|
1176
|
+
the terminal.
|
1220
1177
|
|
1221
1178
|
@cindex init file
|
1222
1179
|
@cindex @file{.byebugrc}
|
1223
|
-
When you start @
|
1224
|
-
@dfn{init files}, normally called @file{.byebugrc}.
|
1180
|
+
When you start @code{byebug}, it automatically executes commands from its
|
1181
|
+
@dfn{init files}, normally called @file{.byebugrc}. On some configurations of
|
1182
|
+
@code{byebug}, the init file may be known by a different name.
|
1225
1183
|
|
1226
|
-
|
1227
|
-
different name. In particular on MS-Windows (but not cygwin)
|
1228
|
-
@file{byebug.ini} is used.
|
1229
|
-
|
1230
|
-
During startup, @DBG{} does the following:
|
1184
|
+
During startup, @code{byebug} does the following:
|
1231
1185
|
|
1232
1186
|
@enumerate
|
1233
1187
|
@item
|
1234
1188
|
Processes command line options and operands.
|
1235
1189
|
|
1236
1190
|
@item
|
1237
|
-
Reads the init file in your current directory, if any, and
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
directory, and another, specific to the program you are debugging, in
|
1243
|
-
the directory where you invoke @DBG{}.
|
1191
|
+
Reads the init file in your current directory, if any, and then checks your home
|
1192
|
+
directory. The home directory is the directory named in the @code{HOME} or
|
1193
|
+
@code{HOMEPATH} environment variable. Thus, you can have more than one init
|
1194
|
+
file, one generic in your home directory, and another, specific to the program
|
1195
|
+
you are debugging, in the directory where you invoke @code{byebug}.
|
1244
1196
|
|
1245
1197
|
@item
|
1246
1198
|
Reads command files specified by the @samp{--script} option.
|
1247
1199
|
@end enumerate
|
1248
1200
|
|
1249
|
-
You can also request the execution of a command file with the
|
1250
|
-
|
1201
|
+
You can also request the execution of a command file with the @code{source}
|
1202
|
+
command, @pxref{Source}.
|
1251
1203
|
|
1252
1204
|
@node Quitting byebug
|
1253
1205
|
@section Quitting byebug
|
1254
1206
|
|
1255
1207
|
@cindex interrupt
|
1256
|
-
An interrupt (often @kbd{C-c}) does not exit from @
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
byebug}).
|
1208
|
+
An interrupt (often @kbd{C-c}) does not exit from @code{byebug}, but rather
|
1209
|
+
terminates the action of any @code{byebug} command that is in progress and
|
1210
|
+
returns to @code{byebug} command level. Inside a debugger command interpreter,
|
1211
|
+
use @code{quit} command (@pxref{Control, ,Quitting byebug}).
|
1261
1212
|
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1213
|
+
Another way to terminate byebug is to use the @code{kill} command. This does the
|
1214
|
+
more forceful @code{kill -9}. It can be used in cases where @code{quit} doesn't
|
1215
|
+
work.
|
1265
1216
|
|
1266
1217
|
@node Calling from Program
|
1267
1218
|
@section Calling byebug from inside your Ruby program
|
1268
1219
|
|
1269
|
-
Running a program from byebug adds a bit of overhead and slows
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
byebug
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
or slowdown until you reach the point at which you want to start
|
1282
|
-
debugging. However here you must change the script and make an
|
1283
|
-
explicit call to byebug. Because byebug isn't involved
|
1284
|
-
before the first call, there is no overhead and the script will run
|
1220
|
+
Running a program from byebug adds a bit of overhead and slows down your program
|
1221
|
+
a little. Furthermore, by necessity, debuggers change the operation of the
|
1222
|
+
program they are debugging. And this can lead to unexpected and unwanted
|
1223
|
+
differences. It has happened so often that the term ``Heisenbugs'' (see
|
1224
|
+
@url{http://en.wikipedia.org/wiki/Heisenbug}) was coined to describe the
|
1225
|
+
situation where using a debugger (among other possibilities) changes the
|
1226
|
+
behavior of the program so that the bug doesn't manifest itself anymore.
|
1227
|
+
|
1228
|
+
There is another way to get into byebug which adds no overhead or slowdown until
|
1229
|
+
you reach the point at which you want to start debugging. However here you must
|
1230
|
+
change the script and make an explicit call to byebug. Because byebug isn't
|
1231
|
+
involved before the first call, there is no overhead and the script will run
|
1285
1232
|
at the same speed as if there were no byebug.
|
1286
1233
|
|
1287
|
-
There are three parts to calling byebug from inside the script,
|
1288
|
-
|
1289
|
-
|
1290
|
-
stop.
|
1234
|
+
There are three parts to calling byebug from inside the script, ``requiring''
|
1235
|
+
the gem, telling byebug to start tracking things and then making an explicit
|
1236
|
+
breakpoints.
|
1291
1237
|
|
1292
1238
|
To get byebug class accessible from your Ruby program:
|
1293
|
-
|
1294
1239
|
@smallexample
|
1295
1240
|
require 'byebug'
|
1296
1241
|
@end smallexample
|
1297
|
-
After @code{require 'byebug'}, it's possible to set some of the
|
1298
|
-
byebug variables influence preferences. For example if you want to
|
1299
|
-
have @ttDBG run a @code{list} command every time it stops you set the
|
1300
|
-
variable @code{Byebug.settings[:autolist]}. @pxref{Byebug.settings} has a
|
1301
|
-
list of variable settings and the default values. Byebug settings
|
1302
|
-
can also be set in @code{.byebugrc} as byebug
|
1303
|
-
commands. @pxref{Command Files}
|
1304
1242
|
|
1305
|
-
|
1243
|
+
After @code{require 'byebug'}, it's possible to set some of the byebug variables
|
1244
|
+
influence preferences. For example if you want to have @code{byebug} run a
|
1245
|
+
@code{list} command every time it stops you set the variable
|
1246
|
+
@code{Byebug.settings[:autolist]}. @pxref{Byebug.settings} has a list of
|
1247
|
+
variable settings and the default values. Byebug settings can also be set in
|
1248
|
+
@code{.byebugrc} as byebug commands. @pxref{Command Files}
|
1306
1249
|
|
1250
|
+
To tell byebug to start tracking things:
|
1307
1251
|
@smallexample
|
1308
1252
|
Byebug.start
|
1309
1253
|
@end smallexample
|
1310
1254
|
|
1311
|
-
There is also a @code{Byebug.stop} to turn off byebug tracking. If
|
1312
|
-
|
1313
|
-
|
1314
|
-
@code{Byebug.
|
1315
|
-
|
1316
|
-
|
1317
|
-
@code{stop} will occur. See @ref{Byebug.start with a block}.
|
1255
|
+
There is also a @code{Byebug.stop} to turn off byebug tracking. If speed is
|
1256
|
+
crucial, you may want to start and stop this around certain sections of code.
|
1257
|
+
Alternatively, instead of issuing an explicit @code{Byebug.stop} you can add a
|
1258
|
+
block to the @code{Byebug.start} and debugging is turned on for that block. If
|
1259
|
+
the block of code raises an uncaught exception that would cause the block to
|
1260
|
+
terminate, the @code{stop} will occur. See @ref{Byebug.start with a block}.
|
1318
1261
|
|
1319
1262
|
And finally to enter byebug:
|
1320
|
-
|
1321
1263
|
@smallexample
|
1322
1264
|
byebug
|
1323
1265
|
@end smallexample
|
1324
1266
|
|
1325
|
-
As indicated above, when @code{byebug} is run a @code{.byebugrc}
|
1326
|
-
|
1267
|
+
As indicated above, when @code{byebug} is run a @code{.byebugrc} profile is read
|
1268
|
+
if that file exists.
|
1327
1269
|
|
1328
|
-
You may want to
|
1329
|
-
|
1330
|
-
|
1331
|
-
conditional expression, for example:
|
1270
|
+
You may want to enter byebug at several points in the program where there is a
|
1271
|
+
problem you want to investigate. And since @code{byebug} is just a method call
|
1272
|
+
it's possible enclose it in a conditional expression, for example:
|
1332
1273
|
@smallexample
|
1333
1274
|
byebug if 'bar' == foo and 20 == iter_count
|
1334
1275
|
@end smallexample
|
1335
1276
|
|
1336
|
-
Although each step does a very specific thing which offers great
|
1337
|
-
|
1338
|
-
|
1277
|
+
Although each step does a very specific thing which offers great flexibility, in
|
1278
|
+
order to make getting into byebug easier the three steps have been rolled into
|
1279
|
+
one command:
|
1339
1280
|
@smallexample
|
1340
1281
|
require "byebug/byebug"
|
1341
1282
|
@end smallexample
|
@@ -1344,57 +1285,54 @@ require "byebug/byebug"
|
|
1344
1285
|
@chapter @code{byebug} Command Reference
|
1345
1286
|
|
1346
1287
|
@menu
|
1347
|
-
* Command Interfaces::
|
1348
|
-
* Command Syntax::
|
1349
|
-
* Command Output::
|
1350
|
-
* Help::
|
1351
|
-
* Control::
|
1352
|
-
* DisplayCommands::
|
1353
|
-
* PrintCommands::
|
1354
|
-
* PrintVars::
|
1355
|
-
* List::
|
1356
|
-
* Edit::
|
1357
|
-
* FrameCommands::
|
1358
|
-
* Stopping::
|
1359
|
-
* byebug settings::
|
1360
|
-
* Program Information::
|
1288
|
+
* Command Interfaces:: The kinds of interface used to interact with byebug
|
1289
|
+
* Command Syntax:: How to give commands to byebug
|
1290
|
+
* Command Output:: How byebug presents its output
|
1291
|
+
* Help:: How to ask for help (help)
|
1292
|
+
* Control:: Controlling byebug (quit, restart, interrupt)
|
1293
|
+
* DisplayCommands:: Executing expressions on stop (display, undisplay)
|
1294
|
+
* PrintCommands:: Evaluating and Printing Expressions (p, pp, ps, pp, irb)
|
1295
|
+
* PrintVars:: Printing Variables (var)
|
1296
|
+
* List:: Examining Program Source Files (list)
|
1297
|
+
* Edit:: Editing source files (edit)
|
1298
|
+
* FrameCommands:: Examining the stack frame (where, up, down, frame)
|
1299
|
+
* Stopping:: Stopping and continuing (break, watch, step, cont...)
|
1300
|
+
* byebug settings:: byebug-settings (set args, set autoeval, ...)
|
1301
|
+
* Program Information:: Program Status (info)
|
1361
1302
|
@end menu
|
1362
1303
|
|
1363
1304
|
@node Command Interfaces
|
1364
1305
|
@section Command Interfaces
|
1365
|
-
There are several ways one can talk to @code{byebug} and get
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
we talk about issuing commands describing the responses elicited,
|
1380
|
-
we'll assume we are working with the local interface.
|
1306
|
+
There are several ways one can talk to @code{byebug} and get results. The
|
1307
|
+
simplest way is via a command-line interface directly talking to byebug. This is
|
1308
|
+
referred to below as a ``Local Interface''. It's also possible to run byebug and
|
1309
|
+
set up a port by which some other process can connect and control the debug
|
1310
|
+
session. This is called a ``Remote Interface''. When you want to gain access to
|
1311
|
+
a remote interface you need to run @code{byebug} using a ``Control Interface''.
|
1312
|
+
This interface might not be the same process as the process running the debugged
|
1313
|
+
program and might not even be running on the same computer.
|
1314
|
+
|
1315
|
+
Other front-ends may use one of these and build on top and provide other
|
1316
|
+
(richer) interfaces. Although many of the commands are available on all
|
1317
|
+
interfaces some are not. Most of the time in this manual when we talk about
|
1318
|
+
issuing commands describing the responses elicited, we'll assume we are working
|
1319
|
+
with the local interface.
|
1381
1320
|
|
1382
1321
|
@node Command Syntax
|
1383
1322
|
@section Command Syntax
|
1384
|
-
Usually a command is put on a single line. There is no limit on how long
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
arguments.
|
1323
|
+
Usually a command is put on a single line. There is no limit on how long it can
|
1324
|
+
be. It starts with a command name, which is followed by arguments whose meaning
|
1325
|
+
depends on the command name. For example, the command @code{step} accepts an
|
1326
|
+
argument which is the number of times to step, as in @code{step 5}. You can also
|
1327
|
+
use the @code{step} command with no arguments. Some commands do not allow any
|
1328
|
+
arguments.
|
1390
1329
|
|
1391
|
-
Multiple commands can be put on a line by separating each with a
|
1392
|
-
|
1393
|
-
|
1330
|
+
Multiple commands can be put on a line by separating each with a semicolon
|
1331
|
+
(@code{;}). You can disable the meaning of a semicolon to separate commands by
|
1332
|
+
escaping it with a backslash.
|
1394
1333
|
|
1395
|
-
For example, if you have @code{autoeval} (@ref{Autoeval}) set, you
|
1396
|
-
|
1397
|
-
number:
|
1334
|
+
For example, if you have @code{autoeval} (@ref{Autoeval}) set, you might want to
|
1335
|
+
enter the following code to compute the 5th Fibonacci number:
|
1398
1336
|
@smallexample
|
1399
1337
|
# Compute the 5 Fibonaci number
|
1400
1338
|
(byebug:1) set autoeval on
|
@@ -1409,35 +1347,33 @@ SyntaxError Exception: compile error
|
|
1409
1347
|
fib2
|
1410
1348
|
8
|
1411
1349
|
@end smallexample
|
1412
|
-
You might also consider using the @code{irb} command, @ref{irb}, and
|
1413
|
-
then you won't have to escape semicolons.
|
1414
1350
|
|
1415
|
-
|
1416
|
-
|
1351
|
+
You might also consider using the @code{irb} command, @ref{irb}, and then you
|
1352
|
+
won't have to escape semicolons.
|
1417
1353
|
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
the
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1354
|
+
A blank line as input (typing just @key{<RET>}) means to repeat the previous
|
1355
|
+
command.
|
1356
|
+
|
1357
|
+
In the ``local'' interface, the Ruby Readline module is used. It handles line
|
1358
|
+
editing and retrieval of previous commands. Up arrow, for example moves to the
|
1359
|
+
previous byebug command; down arrow moves to the next more recent command
|
1360
|
+
(provided you are not already at the last command). Command history is saved in
|
1361
|
+
file @code{.byebug_hist}. A limit is put on the history size. You can see this
|
1362
|
+
with the @code{show history size} command. See @ref{History} for history
|
1363
|
+
parameters.
|
1425
1364
|
|
1426
1365
|
@node Command Output
|
1427
1366
|
@section Command Output
|
1367
|
+
In the command-line interface, when @code{byebug} is waiting for input it
|
1368
|
+
presents a prompt of the form @code{(byebug:}@emph{x}@code{)}. If debugging
|
1369
|
+
locally, @emph{x} will be the thread number. Usual the main thread is 1, so
|
1370
|
+
often you'll see @code{(byebug:1)}. In the control interface though @emph{x}
|
1371
|
+
will be @code{ctrl} and in post-mortem debugging @code{post-mortem}.
|
1428
1372
|
|
1429
|
-
In the
|
1430
|
-
|
1431
|
-
@code{
|
1432
|
-
|
1433
|
-
@code{(byebug:1)}. In the control interface though @emph{x} will be
|
1434
|
-
@code{ctrl} and in post-mortem debugging @code{post-mortem}.
|
1435
|
-
|
1436
|
-
In the local interface, whenever @code{byebug} gives an error
|
1437
|
-
message such as for an invalid command, or an invalid location
|
1438
|
-
position, it will generally preface the message with
|
1439
|
-
@code{***}. However if annotation mode is on that the message is put
|
1440
|
-
in a @code{begin-error} annotation and no @code{***} appears.
|
1373
|
+
In the local interface, whenever @code{byebug} gives an error message such as
|
1374
|
+
for an invalid command, or an invalid location position, it will generally
|
1375
|
+
preface the message with @code{***}. However if annotation mode is on then the
|
1376
|
+
message is put in a @code{begin-error} annotation and no @code{***} appears.
|
1441
1377
|
|
1442
1378
|
@node Help
|
1443
1379
|
@section Getting help (@samp{help})
|
@@ -1446,16 +1382,16 @@ in a @code{begin-error} annotation and no @code{***} appears.
|
|
1446
1382
|
* Help for Subcommands::
|
1447
1383
|
@end menu
|
1448
1384
|
|
1449
|
-
Once inside @code{byebug} you can always ask it for information on
|
1450
|
-
|
1385
|
+
Once inside @code{byebug} you can always ask it for information on its commands
|
1386
|
+
using the @code{help} command.
|
1451
1387
|
|
1452
1388
|
@table @code
|
1453
1389
|
@kindex h @r{(@code{help})}
|
1454
1390
|
@kindex help @ovar{command-name}
|
1455
1391
|
@item help
|
1456
1392
|
@itemx h
|
1457
|
-
You can use @code{help} (abbreviated @code{h}) with no arguments to
|
1458
|
-
|
1393
|
+
You can use @code{help} (abbreviated @code{h}) with no arguments to display a
|
1394
|
+
short list of named classes of commands:
|
1459
1395
|
|
1460
1396
|
@flushleft
|
1461
1397
|
@smallexample
|
@@ -1477,7 +1413,7 @@ continue edit frame kill pp restart step var
|
|
1477
1413
|
|
1478
1414
|
@table @code
|
1479
1415
|
@item help @var{command}
|
1480
|
-
With a command name as @code{help} argument, @
|
1416
|
+
With a command name as @code{help} argument, @code{byebug} displays short
|
1481
1417
|
information on how to use that command.
|
1482
1418
|
|
1483
1419
|
@smallexample
|
@@ -1533,15 +1469,15 @@ info variables -- Local and instance variables of the current stack frame
|
|
1533
1469
|
@example
|
1534
1470
|
(byebug:1) @b{help info breakpoints}
|
1535
1471
|
Status of user-settable breakpoints.
|
1536
|
-
Without argument, list info about all breakpoints.
|
1537
|
-
integer argument, list info on that breakpoint.
|
1472
|
+
Without argument, list info about all breakpoints.
|
1473
|
+
With an integer argument, list info on that breakpoint.
|
1538
1474
|
@end example
|
1539
1475
|
|
1540
1476
|
@example
|
1541
1477
|
(byebug:1) @b{help info br}
|
1542
1478
|
Status of user-settable breakpoints.
|
1543
|
-
Without argument, list info about all breakpoints.
|
1544
|
-
integer argument, list info on that breakpoint.
|
1479
|
+
Without argument, list info about all breakpoints.
|
1480
|
+
With an integer argument, list info on that breakpoint.
|
1545
1481
|
@end example
|
1546
1482
|
|
1547
1483
|
@node Control
|
@@ -1556,6 +1492,7 @@ integer argument, list info on that breakpoint.
|
|
1556
1492
|
|
1557
1493
|
@node Quit
|
1558
1494
|
@subsection Quit (@samp{quit})
|
1495
|
+
|
1559
1496
|
@table @code
|
1560
1497
|
@kindex quit @r{[}unconditionally@r{]}
|
1561
1498
|
@kindex q @r{(@code{quit})}
|
@@ -1563,41 +1500,38 @@ integer argument, list info on that breakpoint.
|
|
1563
1500
|
@item exit
|
1564
1501
|
@itemx q
|
1565
1502
|
|
1566
|
-
To exit @
|
1567
|
-
@code{
|
1568
|
-
|
1569
|
-
A simple @code{quit} tries to terminate all threads in effect.
|
1570
|
-
|
1571
|
-
Normally if you are in an interactive session, this command will
|
1572
|
-
prompt to ask if you really want to quit. If you don't want any
|
1573
|
-
questions asked, enter the ``unconditionally''.
|
1503
|
+
To exit @code{byebug}, use the @code{quit} command (abbreviated @code{q}), or
|
1504
|
+
alias @code{exit}. A simple @code{quit} tries to terminate all threads in
|
1505
|
+
effect.
|
1574
1506
|
|
1507
|
+
Normally if you are in an interactive session, this command will prompt to ask
|
1508
|
+
if you really want to quit. If you don't want any questions asked, enter
|
1509
|
+
``unconditionally''.
|
1575
1510
|
@end table
|
1576
1511
|
|
1577
1512
|
@node Restart
|
1578
1513
|
@subsection Restart (@samp{restart})
|
1514
|
+
|
1579
1515
|
@table @code
|
1580
1516
|
@kindex restart @r{[}@var{program args}@r{]}
|
1581
1517
|
@kindex R @r{(@code{restart})}
|
1582
1518
|
@item restart
|
1583
1519
|
@itemx R
|
1520
|
+
Restart the program. This is a re-exec - all byebug state is lost. If command
|
1521
|
+
arguments are passed those are used. Otherwise program arguments from the last
|
1522
|
+
invocation are used.
|
1584
1523
|
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1524
|
+
You won't be able to restart your program in all cases. First, the program
|
1525
|
+
should have been invoked at the outset rather than having been called from
|
1526
|
+
inside your program or invoked as a result of post-mortem handling.
|
1588
1527
|
|
1589
|
-
|
1590
|
-
|
1591
|
-
called from inside your program or invoked as a result of post-mortem
|
1592
|
-
handling.
|
1593
|
-
|
1594
|
-
Also, since this relies on the the OS @code{exec} call, this command
|
1595
|
-
is available only if your OS supports that @code{exec}; OSX for
|
1596
|
-
example does not (yet).
|
1528
|
+
Also, since this relies on the the OS @code{exec} call, this command is
|
1529
|
+
available only if your OS supports @code{exec}; OSX for example does not (yet).
|
1597
1530
|
@end table
|
1598
1531
|
|
1599
1532
|
@node Interrupt
|
1600
1533
|
@subsection Interrupt (@samp{interrupt})
|
1534
|
+
|
1601
1535
|
@table @code
|
1602
1536
|
@kindex interrupt
|
1603
1537
|
@kindex i
|
@@ -1608,15 +1542,16 @@ Interrupt the program. Useful if there are multiple threads running.
|
|
1608
1542
|
|
1609
1543
|
@node Source
|
1610
1544
|
@subsection Running Byebug Commands (@samp{source})
|
1545
|
+
|
1611
1546
|
@table @code
|
1612
1547
|
@kindex source @var{filename}
|
1613
1548
|
@item source @var{filename}
|
1614
1549
|
Execute the command file @var{filename}.
|
1615
1550
|
|
1616
|
-
The lines in a command file are executed sequentially. They are not
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1551
|
+
The lines in a command file are executed sequentially. They are not printed as
|
1552
|
+
they are executed. If there is an error, execution proceeds to the next command
|
1553
|
+
in the file. For information about command files that get run automatically on
|
1554
|
+
startup, @pxref{Command Files}.
|
1620
1555
|
@end table
|
1621
1556
|
|
1622
1557
|
@node DisplayCommands
|
@@ -1624,13 +1559,12 @@ command files that get run automatically on startup, @pxref{Command Files}.
|
|
1624
1559
|
@cindex automatic display
|
1625
1560
|
@cindex display of expressions
|
1626
1561
|
|
1627
|
-
If you find that you want to print the value of an expression
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
automatic display looks like this:
|
1562
|
+
If you find that you want to print the value of an expression frequently (to see
|
1563
|
+
how it changes), you might want to add it to the @dfn{automatic display list} so
|
1564
|
+
that @code{byebug} evaluates a statement each time your program stops or the
|
1565
|
+
statement is shown in line tracing. Each expression added to the list is given a
|
1566
|
+
number to identify it; to remove an expression from the list, you specify that
|
1567
|
+
number. The automatic display looks like this:
|
1634
1568
|
|
1635
1569
|
@smallexample
|
1636
1570
|
(byebug:1) display n
|
@@ -1638,9 +1572,9 @@ automatic display looks like this:
|
|
1638
1572
|
@end smallexample
|
1639
1573
|
|
1640
1574
|
@noindent
|
1641
|
-
This display shows item numbers, expressions and their current values.
|
1642
|
-
|
1643
|
-
|
1575
|
+
This display shows item numbers, expressions and their current values. If the
|
1576
|
+
expression is undefined or illegal the expression will be printed but no value
|
1577
|
+
will appear.
|
1644
1578
|
|
1645
1579
|
@smallexample
|
1646
1580
|
(byebug:1) display undefined_variable
|
@@ -1649,21 +1583,21 @@ printed but no value will appear.
|
|
1649
1583
|
3: 1/0 =
|
1650
1584
|
@end smallexample
|
1651
1585
|
|
1652
|
-
Note: this command uses @code{to_s}
|
1653
|
-
|
1654
|
-
|
1586
|
+
Note: this command uses @code{to_s} in expressions; for example an array
|
1587
|
+
@code{[1, 2]} will appear as @code{12}. For some datatypes like an Array, you
|
1588
|
+
may want to call the @code{inspect} method, for example
|
1655
1589
|
@code{display ARGV.inspect} rather than @code{display ARGV}.
|
1656
1590
|
|
1657
1591
|
@table @code
|
1658
1592
|
@kindex display @ovar{expr}
|
1659
1593
|
@item display @var{expr}
|
1660
|
-
Add the expression @var{expr} to the list of expressions to display
|
1661
|
-
|
1662
|
-
|
1594
|
+
Add the expression @var{expr} to the list of expressions to display each time
|
1595
|
+
your program stops or a line is printed when linetracing is on
|
1596
|
+
(@pxref{DisplayCommands}).
|
1663
1597
|
|
1664
1598
|
@item display
|
1665
|
-
Display the current values of the expressions on the list, just as is
|
1666
|
-
|
1599
|
+
Display the current values of the expressions on the list, just as is done when
|
1600
|
+
your program stops.
|
1667
1601
|
|
1668
1602
|
@kindex undisplay @ovar{num}
|
1669
1603
|
@item undisplay @ovar{num}
|
@@ -1681,31 +1615,29 @@ Show all display expressions
|
|
1681
1615
|
|
1682
1616
|
@kindex disable display
|
1683
1617
|
@item disable display @var{dnums}@dots{}
|
1684
|
-
Disable the display of item numbers @var{dnums}.
|
1685
|
-
|
1686
|
-
enabled again later.
|
1618
|
+
Disable the display of item numbers @var{dnums}. A disabled display item is not
|
1619
|
+
printed automatically, but is not forgotten. It may be enabled again later.
|
1687
1620
|
|
1688
1621
|
@kindex enable display
|
1689
1622
|
@item enable display @var{dnums}@dots{}
|
1690
|
-
Enable display of item numbers @var{dnums}.
|
1691
|
-
|
1623
|
+
Enable display of item numbers @var{dnums}. It becomes effective once again in
|
1624
|
+
auto display of its expression, until you specify otherwise.
|
1692
1625
|
|
1693
1626
|
@end table
|
1694
1627
|
|
1695
1628
|
@node PrintCommands
|
1696
1629
|
@section Evaluating and Printing Expressions (@samp{p}, @samp{pp}, @samp{putl}, @samp{ps}, @samp{irb})
|
1697
1630
|
|
1698
|
-
One way to examine and change data in your script is with the
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
does in @code{irb}.
|
1631
|
+
One way to examine and change data in your script is with the @code{eval}
|
1632
|
+
command (abbreviated @code{p}). A similar command is @code{pp} which tries to
|
1633
|
+
pretty print the result. Finally @code{irb} is useful when you anticipate
|
1634
|
+
examining or changing a number of things and prefer not to have to preface each
|
1635
|
+
command, but rather work as one does in @code{irb}.
|
1704
1636
|
|
1705
1637
|
@menu
|
1706
|
-
* eval::
|
1707
|
-
* pp::
|
1708
|
-
* irb::
|
1638
|
+
* eval:: eval or print an expression (eval, p)
|
1639
|
+
* pp:: pretty print an expression (pp, ps, putl)
|
1640
|
+
* irb:: running irb using the current context
|
1709
1641
|
@end menu
|
1710
1642
|
|
1711
1643
|
@node eval
|
@@ -1716,9 +1648,10 @@ does in @code{irb}.
|
|
1716
1648
|
@item eval @var{expr}
|
1717
1649
|
@itemx p @var{expr}
|
1718
1650
|
|
1719
|
-
Use @code{eval} or @code{p} to evaluate a Ruby expression, @var{expr},
|
1720
|
-
|
1721
|
-
|
1651
|
+
Use @code{eval} or @code{p} to evaluate a Ruby expression, @var{expr}, same as
|
1652
|
+
you would if you were in @code{irb}. If there are many expressions you want to
|
1653
|
+
look at, you may want to go into irb from byebug.
|
1654
|
+
|
1722
1655
|
@smallexample
|
1723
1656
|
@group
|
1724
1657
|
(byebug:p) p n
|
@@ -1747,10 +1680,11 @@ Evaluates and pretty-prints @var{expr}
|
|
1747
1680
|
"/usr/lib/ruby/1.8"]
|
1748
1681
|
@end group
|
1749
1682
|
@end smallexample
|
1683
|
+
|
1750
1684
|
@kindex putl
|
1751
1685
|
@item putl
|
1752
|
-
If the value you want to print is an array, sometimes a columnized
|
1753
|
-
|
1686
|
+
If the value you want to print is an array, sometimes a columnized list looks
|
1687
|
+
nicer:
|
1754
1688
|
@smallexample
|
1755
1689
|
@group
|
1756
1690
|
(byebug:1) @b{putl $LOAD_PATH}
|
@@ -1759,17 +1693,18 @@ list looks nicer:
|
|
1759
1693
|
@end group
|
1760
1694
|
@end smallexample
|
1761
1695
|
|
1762
|
-
Note however that entries are sorted to run down first rather than
|
1763
|
-
|
1696
|
+
Note however that entries are sorted to run down first rather than across. So
|
1697
|
+
in the example above the second entry in the list is
|
1764
1698
|
@code{/usr/lib/ruby/site_ruby/1.8/i586-linux} and the @emph{third} entry is
|
1765
1699
|
@code{/usr/lib/ruby/site_ruby/1.8}.
|
1766
1700
|
|
1767
1701
|
If the value is not an array @code{putl} will just call pretty-print.
|
1702
|
+
|
1768
1703
|
@kindex ps
|
1769
1704
|
@item ps
|
1770
|
-
Sometimes you may want to print the array not only columnized, but
|
1771
|
-
|
1772
|
-
|
1705
|
+
Sometimes you may want to print the array not only columnized, but sorted as
|
1706
|
+
well. The list of byebug help commands appears this way, and so does the output
|
1707
|
+
of the @code{method} commands.
|
1773
1708
|
|
1774
1709
|
@smallexample
|
1775
1710
|
@group
|
@@ -1796,8 +1731,8 @@ included undef_method
|
|
1796
1731
|
@end group
|
1797
1732
|
@end smallexample
|
1798
1733
|
|
1799
|
-
If the value is not an array, @code{ps} will just call pretty-print.
|
1800
|
-
|
1734
|
+
If the value is not an array, @code{ps} will just call pretty-print. See also
|
1735
|
+
the @code{methods}.
|
1801
1736
|
@end table
|
1802
1737
|
|
1803
1738
|
@node irb
|
@@ -1805,20 +1740,20 @@ See also the @code{methods}.
|
|
1805
1740
|
@table @code
|
1806
1741
|
@kindex irb
|
1807
1742
|
@item irb
|
1808
|
-
Run an interactive ruby session (@code{irb}) with the bindings
|
1809
|
-
|
1743
|
+
Run an interactive ruby session (@code{irb}) with the bindings environment set
|
1744
|
+
to the state you are in the program.
|
1745
|
+
|
1746
|
+
When you leave irb and go back to byebug command prompt we show again the file,
|
1747
|
+
line and text position of the program in the same way as when entered byebug. If
|
1748
|
+
you issue a @command{list} without location information, the default location
|
1749
|
+
used is the current line rather than the position may have gotten updated via a
|
1750
|
+
prior @command{list} command.
|
1810
1751
|
|
1811
|
-
When you leave irb and go back to byebug command prompt we show
|
1812
|
-
again the file, line and text position of the program in the same way
|
1813
|
-
as when entered byebug. If you issue a @command{list} without
|
1814
|
-
location information, the default location used is the current line
|
1815
|
-
rather than the position may have gotten updated via a prior
|
1816
|
-
@command{list} command.
|
1817
1752
|
@smallexample
|
1818
1753
|
triangle.rb:4
|
1819
1754
|
def triangle(n)
|
1820
1755
|
(byebug:1) @b{list}
|
1821
|
-
[
|
1756
|
+
[1, 8] in /home/rocky/ruby/triangle.rb
|
1822
1757
|
1 #!/usr/bin/env ruby
|
1823
1758
|
2 # Compute the n'th triangle number - the hard way
|
1824
1759
|
3 # triangle(n) == (n * (n+1)) / 2
|
@@ -1834,7 +1769,7 @@ def triangle(n)
|
|
1834
1769
|
triangle.rb:4
|
1835
1770
|
def triangle(n)
|
1836
1771
|
(byebug:1) @b{list # Note we get the same line range as before going into irb}
|
1837
|
-
[
|
1772
|
+
[1, 8] in /home/rocky/ruby/triangle.rb
|
1838
1773
|
1 #!/usr/bin/env ruby
|
1839
1774
|
2 # Compute the n'th triangle number - the hard way
|
1840
1775
|
3 # triangle(n) == (n * (n+1)) / 2
|
@@ -1877,7 +1812,8 @@ Show methods of @var{object}. Basically this is the same as running
|
|
1877
1812
|
@code{ps object.instance_methods(false)} on @var{object}.
|
1878
1813
|
@item method iv @var{object}
|
1879
1814
|
@kindex method iv @var{object}
|
1880
|
-
Show method instance variables of @var{object}. Basically this is the same as
|
1815
|
+
Show method instance variables of @var{object}. Basically this is the same as
|
1816
|
+
running
|
1881
1817
|
@smallexample
|
1882
1818
|
obj.instance_variables.each do |v|
|
1883
1819
|
puts "%s = %s\n" % [v, obj.instance_variable_get(v)]
|
@@ -1897,30 +1833,24 @@ Show procedure signature of method @var{object}.
|
|
1897
1833
|
on @var{object}.
|
1898
1834
|
@item method @var{class-or-module}
|
1899
1835
|
@kindex method @var{class-or-module}
|
1900
|
-
Show methods of the class or module, @var{class-or-module}. Basically
|
1901
|
-
|
1902
|
-
on @var{class-or-module}.
|
1836
|
+
Show methods of the class or module, @var{class-or-module}. Basically this is
|
1837
|
+
the same as running @code{ps object.methods} on @var{class-or-module}.
|
1903
1838
|
@end table
|
1904
1839
|
|
1905
1840
|
@node List
|
1906
1841
|
@section Examining Program Source Files (@samp{list})
|
1907
1842
|
|
1908
1843
|
@cindex current line
|
1909
|
-
@
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
position as a parameter to the list command.
|
1920
|
-
|
1921
|
-
If you use @value{DBG} through its Emacs interface, you may prefer to
|
1922
|
-
use Emacs facilities to view source.
|
1923
|
-
@c @pxref{GNU Emacs}.
|
1844
|
+
@code{byebug} can print parts of your script's source. When your script stops,
|
1845
|
+
@code{byebug} spontaneously prints the line where it stopped and the text of
|
1846
|
+
that line. Likewise, when you select a stack frame (@pxref{Selection})
|
1847
|
+
@code{byebug} prints the line where execution in that frame has stopped.
|
1848
|
+
Implicitly there is a default line location. Each time a list command is run
|
1849
|
+
that implicit location is updated, so that running several list commands in
|
1850
|
+
succession shows a contiguous block of program text.
|
1851
|
+
|
1852
|
+
You can print other portions of source files by giving an explicit position as a
|
1853
|
+
parameter to the list command.
|
1924
1854
|
|
1925
1855
|
@kindex list @ovar{line-number}
|
1926
1856
|
@kindex l @r{(@code{list})}
|
@@ -1978,8 +1908,9 @@ recognizes the following command-line syntax:
|
|
1978
1908
|
ex +@var{number} file
|
1979
1909
|
@end smallexample
|
1980
1910
|
The optional numeric value +@var{number} specifies the number of the line in the
|
1981
|
-
file where to start editing.
|
1911
|
+
file where to start editing. For example, to configure @code{byebug} to use the
|
1982
1912
|
@code{vi} editor, you could use these commands with the @code{sh} shell:
|
1913
|
+
|
1983
1914
|
@smallexample
|
1984
1915
|
EDITOR=/usr/bin/vi
|
1985
1916
|
export EDITOR
|
@@ -1994,47 +1925,44 @@ gdb @dots{}
|
|
1994
1925
|
@table @code
|
1995
1926
|
@kindex edit @ovar{line-specification}
|
1996
1927
|
@item edit @ovar{line specification}
|
1997
|
-
Edit line specification using the editor specified by the
|
1998
|
-
|
1928
|
+
Edit line specification using the editor specified by the @code{EDITOR}
|
1929
|
+
environment variable.
|
1999
1930
|
@end table
|
2000
1931
|
|
2001
1932
|
@node FrameCommands
|
2002
1933
|
@section Examining the Stack Frame (@samp{where}, @samp{up}, @samp{down}, @samp{frame})
|
2003
1934
|
|
2004
|
-
When your script has stopped, one thing you'll probably want to know
|
2005
|
-
|
1935
|
+
When your script has stopped, one thing you'll probably want to know is where it
|
1936
|
+
stopped and some idea of how it got there.
|
2006
1937
|
|
2007
1938
|
@cindex call stack
|
2008
|
-
Each time your script performs a function or sends a message to a
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
structure which is yet slightly different.}
|
1939
|
+
Each time your script performs a function or sends a message to a method, or
|
1940
|
+
enters a block, information about this action is saved. The frame stack then is
|
1941
|
+
a history of the blocks that got you to the point that you are currently stopped
|
1942
|
+
at.@footnote{More accurately we should call this a ``block stack''; but we'll
|
1943
|
+
use the name that is more commonly used. And internally in Ruby, there is
|
1944
|
+
``FRAME'' structure which is yet slightly different.}
|
2015
1945
|
|
2016
1946
|
@cindex selected block
|
2017
|
-
One entry in call stack is @dfn{selected} by @
|
2018
|
-
@
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
When your program stops, @DBG{} automatically selects the
|
2025
|
-
currently executing frame and describes it briefly, similar to the
|
2026
|
-
@code{frame} command.
|
2027
|
-
|
2028
|
-
After switching frames, when you issue a @code{list} command without
|
2029
|
-
any position information, the position used is location in the frame
|
2030
|
-
that you just switched between, rather than a location that got
|
2031
|
-
updated via a prior @code{list} command.
|
1947
|
+
One entry in call stack is @dfn{selected} by @code{byebug} and many
|
1948
|
+
@code{byebug} commands refer implicitly to the selected block. In particular,
|
1949
|
+
whenever you ask @code{byebug} to list lines without giving a line number or
|
1950
|
+
location the value is found in the selected frame. There are special
|
1951
|
+
@code{byebug} commands to select whichever frame you are interested in.
|
1952
|
+
@xref{Selection, ,Selecting a frame}.
|
2032
1953
|
|
2033
|
-
@
|
2034
|
-
|
2035
|
-
* Backtrace:: Backtraces (where)
|
2036
|
-
* Selection:: Selecting a frame (up, down, frame)
|
1954
|
+
When your program stops, @code{byebug} automatically selects the currently
|
1955
|
+
executing frame and describes it briefly, similarly to the @code{frame} command.
|
2037
1956
|
|
1957
|
+
After switching frames, when you issue a @code{list} command without any
|
1958
|
+
position information, the position used is the location in the frame that you
|
1959
|
+
just switched to, rather than a location that got updated via a prior
|
1960
|
+
@code{list} command.
|
1961
|
+
|
1962
|
+
@menu
|
1963
|
+
* Frames:: Stack frames
|
1964
|
+
* Backtrace:: Backtraces (where)
|
1965
|
+
* Selection:: Selecting a frame (up, down, frame)
|
2038
1966
|
@end menu
|
2039
1967
|
|
2040
1968
|
@node Frames
|
@@ -2042,30 +1970,29 @@ updated via a prior @code{list} command.
|
|
2042
1970
|
|
2043
1971
|
@cindex frame, definition
|
2044
1972
|
@cindex stack frame
|
2045
|
-
The block stack is divided up into contiguous pieces called @dfn{stack
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
1973
|
+
The block stack is divided up into contiguous pieces called @dfn{stack frames},
|
1974
|
+
@dfn{frames}, or @dfn{blocks} for short; each frame/block has a scope associated
|
1975
|
+
with itr. It contains a line number and the source-file name that the line
|
1976
|
+
refers to. If the frame/block is the beginning of a method or function it also
|
1977
|
+
contains the function name.
|
2050
1978
|
|
2051
1979
|
@cindex initial frame
|
2052
1980
|
@cindex outermost frame
|
2053
1981
|
@cindex innermost frame
|
2054
|
-
When your script is started, the stack has only one frame, that of the
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
1982
|
+
When your script is started, the stack has only one frame, that of the function
|
1983
|
+
@code{main}. This is called the @dfn{initial} frame or the @dfn{outermost}
|
1984
|
+
frame. Each time a function is called, a new frame is made. Each time a function
|
1985
|
+
returns, the frame for that function invocation is eliminated. If a function is
|
1986
|
+
recursive, there can be many frames for the same function. The frame for the
|
1987
|
+
function in which execution is actually occurring is called the @dfn{innermost}
|
1988
|
+
frame. This is the most recently created of all the stack frames that still
|
1989
|
+
exist.
|
2062
1990
|
|
2063
1991
|
@cindex frame number
|
2064
|
-
@
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
frames in @value{DBG} commands.
|
1992
|
+
@code{byebug} assigns numbers to all existing stack frames, starting with zero
|
1993
|
+
for the innermost frame, one for the frame that called it, and so on upward.
|
1994
|
+
These numbers do not really exist in your script; they are assigned by
|
1995
|
+
@code{byebug} to give you a way of designating stack frames inside commands.
|
2069
1996
|
|
2070
1997
|
@node Backtrace
|
2071
1998
|
@subsection Backtraces (@samp{where})
|
@@ -2110,7 +2037,6 @@ Similar, but print only the outermost @var{n} frames.
|
|
2110
2037
|
|
2111
2038
|
@node Selection
|
2112
2039
|
@subsection Selecting a frame (@samp{up}, @samp{down}, @samp{frame})
|
2113
|
-
|
2114
2040
|
Commands for listing source code in your script work on whichever stack frame is
|
2115
2041
|
selected at the moment. Here are the commands for selecting a stack frame; all
|
2116
2042
|
of them finish by printing a brief description of the stack frame just selected.
|
@@ -2130,7 +2056,7 @@ a resynchronization if there is a front end also watching over things.
|
|
2130
2056
|
@kindex down @ovar{n}
|
2131
2057
|
@item down @ovar{n}
|
2132
2058
|
Move @var{n} frames down the stack. For positive numbers @var{n}, this advances
|
2133
|
-
|
2059
|
+
towards the innermost frame, to lower frame numbers, to frames that were created
|
2134
2060
|
more recently. Using a negative @var{n} is the same as issuing a @code{up}
|
2135
2061
|
command of the absolute value of the @var{n}. Using zero for @var{n} does no
|
2136
2062
|
frame adjustment, but since the current position is redisplayed, it may trigger
|
@@ -2162,46 +2088,42 @@ to that frame of that thread.
|
|
2162
2088
|
|
2163
2089
|
@node Stopping
|
2164
2090
|
@section Stopping and Resuming Execution
|
2165
|
-
|
2166
2091
|
One important use of a debugger is to stop your program @emph{before} it
|
2167
2092
|
terminates, so that if your script runs into trouble you can investigate and
|
2168
2093
|
find out why. However should your script accidentally continue to termination,
|
2169
|
-
it can be arranged for @
|
2170
|
-
instruction. That way, you can restart the program using the same
|
2171
|
-
arguments.
|
2094
|
+
it can be arranged for @code{byebug} to not to leave byebug without your
|
2095
|
+
explicit instruction. That way, you can restart the program using the same
|
2096
|
+
command arguments.
|
2172
2097
|
|
2173
|
-
Inside @
|
2174
|
-
signal, a breakpoint, or reaching a new line after a byebug command such
|
2175
|
-
@code{step}. You may then examine and change variables, set new breakpoints
|
2176
|
-
remove old ones, and then continue execution.
|
2098
|
+
Inside @code{byebug}, your script may stop for any of several reasons, such as a
|
2099
|
+
signal, a breakpoint, or reaching a new line after a @code{byebug} command such
|
2100
|
+
as @code{step}. You may then examine and change variables, set new breakpoints
|
2101
|
+
or remove old ones, and then continue execution.
|
2177
2102
|
|
2178
2103
|
@menu
|
2179
|
-
* Breakpoints::
|
2180
|
-
* Disabling::
|
2181
|
-
* Conditions::
|
2182
|
-
* Resuming Execution::
|
2104
|
+
* Breakpoints:: Breakpoints (break, catch, delete)
|
2105
|
+
* Disabling:: Disabling breakpoints (disable, enable)
|
2106
|
+
* Conditions:: Break conditions (condition)
|
2107
|
+
* Resuming Execution:: Resuming execution (continue, step, next, finish)
|
2183
2108
|
@end menu
|
2184
2109
|
|
2185
2110
|
@node Breakpoints
|
2186
2111
|
@subsection Breakpoints (@samp{break}, @samp{catch}, @samp{delete})
|
2187
2112
|
|
2188
2113
|
@cindex breakpoints
|
2189
|
-
A @dfn{breakpoint} makes your script stop whenever a certain point in
|
2190
|
-
|
2191
|
-
|
2192
|
-
|
2193
|
-
You specify the place where your script should stop with the
|
2194
|
-
@code{break} command and its variants.
|
2114
|
+
A @dfn{breakpoint} makes your script stop whenever a certain point in the
|
2115
|
+
program is reached. For each breakpoint, you can add conditions to control in
|
2116
|
+
finer detail whether your script stops. You specify the place where your script
|
2117
|
+
should stop with the @code{break} command and its variants.
|
2195
2118
|
|
2196
2119
|
@cindex breakpoint numbers
|
2197
2120
|
@cindex numbers for breakpoints
|
2198
|
-
@
|
2199
|
-
|
2200
|
-
|
2201
|
-
|
2202
|
-
|
2203
|
-
|
2204
|
-
enable it again.
|
2121
|
+
@code{byebug} assigns a number to each breakpoint when you create it; these
|
2122
|
+
numbers are successive integers starting with one. In many of the commands for
|
2123
|
+
controlling various features of breakpoints you use the breakpoint number to say
|
2124
|
+
which breakpoint you want to change. Each breakpoint may be @dfn{enabled} or
|
2125
|
+
@dfn{disabled}; if disabled, it has no effect on your script until you enable it
|
2126
|
+
again.
|
2205
2127
|
|
2206
2128
|
|
2207
2129
|
@table @code
|
@@ -2211,20 +2133,19 @@ enable it again.
|
|
2211
2133
|
Set a breakpoint at the current line.
|
2212
2134
|
|
2213
2135
|
@item break @var{linenum}
|
2214
|
-
Set a breakpoint at line @var{linenum} in the current source file.
|
2215
|
-
|
2216
|
-
|
2217
|
-
code on that line.
|
2136
|
+
Set a breakpoint at line @var{linenum} in the current source file. The current
|
2137
|
+
source file is the last file whose source text was printed. The breakpoint will
|
2138
|
+
stop your script just before it executes any of the code on that line.
|
2218
2139
|
|
2219
2140
|
@item break @var{filename}:@var{linenum}
|
2220
2141
|
Set a breakpoint at line @var{linenum} in source file @var{filename}.
|
2221
2142
|
|
2222
|
-
What may be a little tricky when specifying the filename is getting
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2143
|
+
What may be a little tricky when specifying the filename is getting the name
|
2144
|
+
recognized by @code{byebug}. If you get a message the message ``@code{No source
|
2145
|
+
file named ...}'', then you may need to qualify the name more fully. To see what
|
2146
|
+
files are loaded you can use the @code{info files} or @code{info file} commands.
|
2147
|
+
If you want the name @code{byebug} thinks of as the current file, use
|
2148
|
+
@code{info line}.
|
2228
2149
|
|
2229
2150
|
Here's an example:
|
2230
2151
|
@example
|
@@ -2247,20 +2168,19 @@ File /home/rocky/ruby/gcd.rb
|
|
2247
2168
|
@end example
|
2248
2169
|
|
2249
2170
|
@item break @var{class}:@var{method}
|
2250
|
-
Set a breakpoint in class @var{class} method @var{method}. You can
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
|
2255
|
-
program), then use the name @code{Object}.
|
2171
|
+
Set a breakpoint in class @var{class} method @var{method}. You can also use a
|
2172
|
+
period @code{.} instead of a colon @code{:}. Note that two colons @code{::} are
|
2173
|
+
not used. Also note a class @emph{must} be specified here. If the method you
|
2174
|
+
want to stop in is in the main class (i.e. the class that @code{self} belongs to
|
2175
|
+
at the start of the program), then use the name @code{Object}.
|
2256
2176
|
|
2257
2177
|
@kindex catch @ovar{exception} @r{[} on | 1 | off | 0 @r{]}
|
2258
2178
|
@kindex cat @r{(@code{catch})}
|
2259
2179
|
@item catch @ovar{exception} @r{[} on | 1 | off | 0 @r{]}
|
2260
2180
|
Set catchpoint to an exception. Without an exception name show catchpoints.
|
2261
2181
|
|
2262
|
-
With an ``on'' or ``off'' parameter, turn handling the exception on or
|
2263
|
-
|
2182
|
+
With an ``on'' or ``off'' parameter, turn handling the exception on or off. To
|
2183
|
+
delete all exceptions type ``catch off''.
|
2264
2184
|
|
2265
2185
|
@cindex delete breakpoints
|
2266
2186
|
@kindex delete @ovar{breakpoints}
|
@@ -2268,34 +2188,34 @@ off. To delete all exceptions type ``catch off''.
|
|
2268
2188
|
@item delete @ovar{breakpoints}
|
2269
2189
|
Delete the breakpoints specified as arguments.
|
2270
2190
|
|
2271
|
-
If no argument is specified, delete all breakpoints (@
|
2272
|
-
confirmation. You can abbreviate this command as @code{del}.
|
2191
|
+
If no argument is specified, delete all breakpoints (@code{byebug} asks for
|
2192
|
+
confirmation. You can abbreviate this command as @code{del}).
|
2273
2193
|
@kindex info breakpoints
|
2274
2194
|
@cindex @code{$_} and @code{info breakpoints}
|
2275
2195
|
@item info breakpoints @ovar{n}
|
2276
2196
|
@itemx info break @ovar{n}
|
2277
|
-
Print a table of all breakpoints set and not deleted, with the
|
2278
|
-
|
2197
|
+
Print a table of all breakpoints set and not deleted, with the following columns
|
2198
|
+
for each breakpoint:
|
2279
2199
|
|
2280
2200
|
@table @emph
|
2281
2201
|
@item Breakpoint Numbers (@samp{Num})
|
2282
2202
|
@item Enabled or Disabled (@samp{Enb})
|
2283
|
-
Enabled breakpoints are marked with @samp{1}.
|
2284
|
-
|
2203
|
+
Enabled breakpoints are marked with @samp{1}. @samp{0} marks breakpoints that
|
2204
|
+
are disabled (not enabled).
|
2285
2205
|
@item File and Line (@samp{file:line})
|
2286
|
-
The filename and line number inside that file where of breakpoint in
|
2287
|
-
|
2206
|
+
The filename and line number inside that file where of breakpoint in the script.
|
2207
|
+
The file and line are separated with a colon.
|
2288
2208
|
@item Condition
|
2289
|
-
A condition (an arithmetic expression) which when true causes the
|
2290
|
-
|
2209
|
+
A condition (an arithmetic expression) which when true causes the breakpoint to
|
2210
|
+
take effect.
|
2291
2211
|
@end table
|
2292
2212
|
@noindent
|
2293
|
-
If a breakpoint is conditional, @code{info break} shows the condition on
|
2294
|
-
|
2295
|
-
|
2213
|
+
If a breakpoint is conditional, @code{info break} shows the condition on the
|
2214
|
+
line following the affected breakpoint; breakpoint commands, if any, are listed
|
2215
|
+
after that.
|
2296
2216
|
|
2297
|
-
@code{info break} with a breakpoint number @var{n} as argument lists
|
2298
|
-
|
2217
|
+
@code{info break} with a breakpoint number @var{n} as argument lists only that
|
2218
|
+
breakpoint.
|
2299
2219
|
|
2300
2220
|
Examples:
|
2301
2221
|
@example
|
@@ -2312,19 +2232,16 @@ Num Enb What
|
|
2312
2232
|
@node Disabling
|
2313
2233
|
@subsection Disabling breakpoints (@samp{disable}, @samp{enable})
|
2314
2234
|
|
2315
|
-
Rather than deleting a breakpoint, you might
|
2316
|
-
|
2317
|
-
|
2318
|
-
that you can @dfn{enable} it again later.
|
2235
|
+
Rather than deleting a breakpoint, you might prefer to @dfn{disable} it. This
|
2236
|
+
makes the breakpoint inoperative as if it had been deleted, but remembers the
|
2237
|
+
information on the breakpoint so that you can @dfn{enable} it again later.
|
2319
2238
|
|
2320
|
-
You disable and enable breakpoints and catchpoints with the
|
2321
|
-
@code{
|
2322
|
-
|
2323
|
-
|
2324
|
-
numbers to use.
|
2239
|
+
You disable and enable breakpoints and catchpoints with the @code{enable} and
|
2240
|
+
@code{disable} commands, optionally specifying one or more breakpoint numbers as
|
2241
|
+
arguments. Use @code{info break} to print a list of breakpoints and catchpoints
|
2242
|
+
if you do not know which numbers to use.
|
2325
2243
|
|
2326
|
-
A breakpoint or catchpoint can have any different
|
2327
|
-
states of enablement:
|
2244
|
+
A breakpoint or catchpoint can have any different states of enablement:
|
2328
2245
|
|
2329
2246
|
@itemize @bullet
|
2330
2247
|
@item
|
@@ -2334,27 +2251,25 @@ with the @code{break} command starts out in this state.
|
|
2334
2251
|
Disabled. The breakpoint has no effect on your program.
|
2335
2252
|
@end itemize
|
2336
2253
|
|
2337
|
-
You can use the following commands to enable or disable breakpoints
|
2338
|
-
|
2254
|
+
You can use the following commands to enable or disable breakpoints and
|
2255
|
+
catchpoints:
|
2339
2256
|
|
2340
2257
|
@table @code
|
2341
2258
|
@kindex disable breakpoints
|
2342
2259
|
@item disable @var{breakpoints}
|
2343
|
-
Disable the specified breakpoints
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
@code{disable} as @code{dis}.
|
2260
|
+
Disable the specified breakpoints or all breakpoints, if none are listed. A
|
2261
|
+
disabled breakpoint has no effect but it is not forgotten. All options such as
|
2262
|
+
ignore-counts, conditions and commands are remembered in case the breakpoint is
|
2263
|
+
enabled again later. You may abbreviate @code{disable} as @code{dis}.
|
2348
2264
|
|
2349
2265
|
@kindex enable breakpoints
|
2350
2266
|
@item enable @var{breakpoints}
|
2351
|
-
Enable the specified breakpoints (or all defined breakpoints).
|
2352
|
-
|
2353
|
-
|
2267
|
+
Enable the specified breakpoints (or all defined breakpoints). They become
|
2268
|
+
effective once again in stopping your program.
|
2354
2269
|
@end table
|
2355
2270
|
|
2356
2271
|
Breakpoints that you set are initially enabled; subsequently, they become
|
2357
|
-
disabled or enabled only when you use one of the commands above.
|
2272
|
+
disabled or enabled only when you use one of the commands above. (The command
|
2358
2273
|
@code{until} can set and delete a breakpoint of its own, but it does not change
|
2359
2274
|
the state of your other breakpoints; see @ref{Resuming Execution}.)
|
2360
2275
|
|
@@ -2363,42 +2278,40 @@ the state of your other breakpoints; see @ref{Resuming Execution}.)
|
|
2363
2278
|
@cindex conditional breakpoints
|
2364
2279
|
@cindex breakpoint conditions
|
2365
2280
|
|
2366
|
-
The simplest sort of breakpoint breaks every time your script reaches
|
2367
|
-
|
2368
|
-
|
2281
|
+
The simplest sort of breakpoint breaks every time your script reaches a
|
2282
|
+
specified place. You can also specify a @dfn{condition} for a breakpoint. A
|
2283
|
+
condition is just a Ruby expression.
|
2369
2284
|
|
2370
|
-
Break conditions can be specified when a breakpoint is set, by using
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
@
|
2375
|
-
with the @code{condition} command.
|
2285
|
+
Break conditions can be specified when a breakpoint is set, by using @samp{if}
|
2286
|
+
in the arguments to the @code{break} command. A breakpoint with a condition
|
2287
|
+
evaluates the expression each time your script reaches it, and your script stops
|
2288
|
+
only if the condition is @emph{true}. They can also be changed at any time with
|
2289
|
+
the @code{condition} command.
|
2376
2290
|
|
2377
2291
|
@ifset FINISHED
|
2378
|
-
You can also use the @code{if} keyword with the @code{watch} command.
|
2379
|
-
|
2380
|
-
|
2381
|
-
catchpoint.
|
2292
|
+
You can also use the @code{if} keyword with the @code{watch} command. The
|
2293
|
+
@code{catch} command does not recognize the @code{if} keyword; @code{condition}
|
2294
|
+
is the only way to impose a further condition on a catchpoint.
|
2382
2295
|
@end ifset
|
2383
2296
|
|
2384
2297
|
@table @code
|
2385
2298
|
@kindex condition
|
2386
2299
|
@item condition @var{bnum} @var{expression}
|
2387
|
-
Specify @var{expression} as the break condition for breakpoint
|
2388
|
-
|
2389
|
-
|
2300
|
+
Specify @var{expression} as the break condition for breakpoint @var{bnum}. After
|
2301
|
+
you set a condition, breakpoint @var{bnum} stops your program only if the value
|
2302
|
+
of @var{expression} is true (nonzero).
|
2390
2303
|
|
2391
2304
|
@item condition @var{bnum}
|
2392
|
-
Remove the condition from breakpoint number @var{bnum}. It becomes
|
2393
|
-
|
2305
|
+
Remove the condition from breakpoint number @var{bnum}. It becomes an ordinary
|
2306
|
+
unconditional breakpoint.
|
2394
2307
|
@end table
|
2395
2308
|
|
2396
2309
|
@ifset FINISHED
|
2397
|
-
When you use @code{condition}, @
|
2398
|
-
|
2399
|
-
|
2400
|
-
|
2401
|
-
|
2310
|
+
When you use @code{condition}, @code{byebug} checks @var{expression} immediately
|
2311
|
+
for syntactic correctness, and to determine whether symbols in it have referents
|
2312
|
+
in the context of your breakpoint. If @var{expression} uses symbols not
|
2313
|
+
referenced in the context of the breakpoint, @code{byebug} prints an error
|
2314
|
+
message:
|
2402
2315
|
|
2403
2316
|
@example
|
2404
2317
|
No symbol "foo" in current context.
|
@@ -2406,9 +2319,9 @@ No symbol "foo" in current context.
|
|
2406
2319
|
@end ifset
|
2407
2320
|
|
2408
2321
|
@noindent
|
2409
|
-
The
|
2410
|
-
|
2411
|
-
|
2322
|
+
The debugger does not actually evaluate @var{expression} at the time the
|
2323
|
+
@code{condition} command (or a command that sets a breakpoint with a condition,
|
2324
|
+
like @code{break if @dots{}}) is given, however.
|
2412
2325
|
|
2413
2326
|
Examples;
|
2414
2327
|
@example
|
@@ -2419,8 +2332,8 @@ condition 1 # Change that! Unconditionally stop on breakpoint 1.
|
|
2419
2332
|
@node Resuming Execution
|
2420
2333
|
@subsection Resuming Execution (@samp{step}, @samp{next}, @samp{finish}, @samp{continue}, @samp{jump})
|
2421
2334
|
|
2422
|
-
A typical technique for using stepping is to set a breakpoint
|
2423
|
-
@pxref{Breakpoints}) at the beginning of the function or the section of your
|
2335
|
+
A typical technique for using stepping is to set a breakpoint
|
2336
|
+
(@pxref{Breakpoints}) at the beginning of the function or the section of your
|
2424
2337
|
script where a problem is believed to lie, run your script until it stops at
|
2425
2338
|
that breakpoint, and then step through the suspect area, examining the variables
|
2426
2339
|
that are interesting, until you see the problem happen.
|
@@ -2429,17 +2342,17 @@ that are interesting, until you see the problem happen.
|
|
2429
2342
|
@cindex continuing
|
2430
2343
|
@cindex resuming execution
|
2431
2344
|
@dfn{Continuing} means resuming program execution until your script completes
|
2432
|
-
normally.
|
2345
|
+
normally. In contrast, @dfn{stepping} means executing just one more ``step'' of
|
2433
2346
|
your script, where ``step'' may mean one line of source code. Either when
|
2434
2347
|
continuing or when stepping, your script may stop even sooner, due to a
|
2435
2348
|
breakpoint or a signal.
|
2436
2349
|
|
2437
2350
|
@menu
|
2438
|
-
* Step::
|
2439
|
-
* Next::
|
2440
|
-
* Finish::
|
2441
|
-
* Continue::
|
2442
|
-
* Jump::
|
2351
|
+
* Step:: running the next statement (step)
|
2352
|
+
* Next:: running the next statement skipping over functions (next)
|
2353
|
+
* Finish:: running until the return of a function or ``source'' (finish)
|
2354
|
+
* Continue:: continuing execution (continue)
|
2355
|
+
* Jump:: jumping to a new line (jump)
|
2443
2356
|
@end menu
|
2444
2357
|
|
2445
2358
|
@node Step
|
@@ -2450,7 +2363,7 @@ breakpoint or a signal.
|
|
2450
2363
|
@kindex s @r{(@code{step})}
|
2451
2364
|
@item step @r{[}+-@r{]} @ovar{count}
|
2452
2365
|
Continue running your program until the next logical stopping point and return
|
2453
|
-
control to @
|
2366
|
+
control to @code{byebug}. This command is abbreviated @code{s}.
|
2454
2367
|
|
2455
2368
|
Just like int the programming language Lisp, Ruby tends to be implemented in a
|
2456
2369
|
highly expression-oriented manner. Therefore things that in other languages may
|
@@ -2562,23 +2475,23 @@ Each @code{set} command has a corresponding @code{show} command which
|
|
2562
2475
|
allows you to see the current value.
|
2563
2476
|
|
2564
2477
|
@menu
|
2565
|
-
* Args::
|
2566
|
-
* Autoeval::
|
2567
|
-
* Autolist::
|
2568
|
-
* Autoirb::
|
2569
|
-
* Autoreload::
|
2570
|
-
* Basename::
|
2571
|
-
* Callstyle::
|
2572
|
-
* Forcestep::
|
2573
|
-
* Fullpath::
|
2574
|
-
* History::
|
2575
|
-
* Keepframebindings::
|
2576
|
-
* Linetrace::
|
2577
|
-
* Linetrace+::
|
2578
|
-
* Listsize::
|
2579
|
-
* Post-mortem::
|
2580
|
-
* Trace::
|
2581
|
-
* Width::
|
2478
|
+
* Args:: Annotation Level
|
2479
|
+
* Autoeval:: Evaluate unrecognized commands
|
2480
|
+
* Autolist:: Execute ``list'' command on every breakpoint
|
2481
|
+
* Autoirb:: Invoke IRB on every stop
|
2482
|
+
* Autoreload:: Reload source code when changed
|
2483
|
+
* Basename:: Report file basename only showing file names
|
2484
|
+
* Callstyle:: Show Report file basename only showing file names
|
2485
|
+
* Forcestep:: Make sure 'next/step' commands always move to a new line
|
2486
|
+
* Fullpath:: Display full file names in frames
|
2487
|
+
* History:: Generic command for showing command history parameters.
|
2488
|
+
* Keepframebindings:: Save frame binding on each call
|
2489
|
+
* Linetrace:: line execution tracing
|
2490
|
+
* Linetrace+:: line tracing style
|
2491
|
+
* Listsize:: Number of lines to try to show in a 'list' command
|
2492
|
+
* Post-mortem:: Whether post-mortem handling is in effect.
|
2493
|
+
* Trace:: Display stack trace when 'eval' raises exception
|
2494
|
+
* Width:: Number of characters byebug thinks are in a line
|
2582
2495
|
@end menu
|
2583
2496
|
|
2584
2497
|
@node Args
|
@@ -2812,8 +2725,8 @@ Shows the list-size setting.
|
|
2812
2725
|
@subsection Show Post-mortem handling
|
2813
2726
|
@table @code
|
2814
2727
|
@kindex show post-mortem
|
2815
|
-
Shows wither post-mortem debugging is in effect. Right now we don't
|
2816
|
-
|
2728
|
+
Shows wither post-mortem debugging is in effect. Right now we don't have the
|
2729
|
+
ability to change that state inside byebug.
|
2817
2730
|
@end table
|
2818
2731
|
|
2819
2732
|
@node Trace
|
@@ -2825,8 +2738,8 @@ have the ability to change the state inside byebug.
|
|
2825
2738
|
@table @code
|
2826
2739
|
@kindex set width @var{column-width}
|
2827
2740
|
@item set width @var{column-width}
|
2828
|
-
Set number of characters byebug
|
2829
|
-
|
2741
|
+
Set number of characters per line of byebug output. We also change OS
|
2742
|
+
environment variable @code{COLUMNS}.
|
2830
2743
|
@kindex show width
|
2831
2744
|
@item show width
|
2832
2745
|
Shows the current width setting.
|
@@ -2835,70 +2748,70 @@ Shows the current width setting.
|
|
2835
2748
|
@node Program Information
|
2836
2749
|
@section Program Information (@samp{info})
|
2837
2750
|
|
2838
|
-
This @code{info} command (abbreviated @code{i}) is for describing the
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
info}}.
|
2751
|
+
This @code{info} command (abbreviated @code{i}) is for describing the state of
|
2752
|
+
your program. For example, you can list the current parameters with
|
2753
|
+
@code{info args} or list the breakpoints you have set with
|
2754
|
+
@code{info breakpoints} or @code{info watchpoints}. You can get a complete list
|
2755
|
+
of @code{info} sub-commands with @w{@code{help info}}.
|
2844
2756
|
|
2845
2757
|
@table @code
|
2846
2758
|
@kindex info args
|
2847
|
-
|
2848
2759
|
@item info args
|
2849
2760
|
Method arguments of the current stack frame.
|
2850
|
-
@kindex info breakpoints
|
2851
2761
|
|
2762
|
+
@kindex info breakpoints
|
2852
2763
|
@item info breakpoints
|
2853
2764
|
Status of user-settable breakpoints
|
2854
|
-
@kindex info display
|
2855
2765
|
|
2766
|
+
@kindex info display
|
2856
2767
|
@item info display
|
2857
2768
|
All display expressions.
|
2858
|
-
@kindex info files
|
2859
2769
|
|
2770
|
+
@kindex info files
|
2860
2771
|
@item info files
|
2861
2772
|
Source files in the program.
|
2862
|
-
@kindex info file
|
2863
2773
|
|
2864
|
-
@
|
2865
|
-
|
2866
|
-
|
2867
|
-
of the file
|
2868
|
-
|
2774
|
+
@kindex info file
|
2775
|
+
@item info file @var{filename} @ovar{all|basic|path|lines|mtime|sha1}
|
2776
|
+
Information about a specific file. Parameter @code{path} gives the full path
|
2777
|
+
name of the file. Parameter @code{lines} gives the number of lines in the file,
|
2778
|
+
@code{mtime} shows the modification time of the file (if available), @code{sha1}
|
2779
|
+
computes a SHA1 hash of the data in the file. @code{all} gives all of the above
|
2780
|
+
information and @code{basic} is equivalent to @code{path} and @code{lines}.
|
2869
2781
|
|
2870
2782
|
@kindex info line
|
2871
2783
|
@item info line
|
2872
2784
|
Line number and file name of current position in source.
|
2785
|
+
|
2873
2786
|
@kindex info locals
|
2874
2787
|
@item info locals
|
2875
2788
|
Local variables of the current stack frame.
|
2789
|
+
|
2876
2790
|
@kindex info program
|
2877
2791
|
@item info program
|
2878
|
-
Display information about the status of your program: whether it is
|
2879
|
-
|
2880
|
-
|
2792
|
+
Display information about the status of your program: whether it is running or
|
2793
|
+
not and why it stopped. If an unhandled exception occurred, the exception class
|
2794
|
+
and @code{to_s} method is called.
|
2795
|
+
|
2881
2796
|
@kindex info stack
|
2882
2797
|
@item info stack
|
2883
2798
|
Backtrace of the stack. An alias for @code{where}. @xref{Backtrace}.
|
2799
|
+
|
2884
2800
|
@kindex info thread
|
2885
2801
|
@item info thread @ovar{thread-number} @r{[} terse | verbose@r{]}
|
2886
|
-
If no thread number is given, we list info for all
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2890
|
-
|
2891
|
-
|
2892
|
-
stack trace is given for each thread.
|
2802
|
+
If no thread number is given, we list info for all threads. @code{terse} and
|
2803
|
+
@code{verbose} options are possible. If terse, just give summary thread name
|
2804
|
+
information. See information under @code{info threads} for more detail about
|
2805
|
+
this summary information.
|
2806
|
+
If @code{verbose} is appended to the end of the command, then the entire stack
|
2807
|
+
trace is given for each thread.
|
2893
2808
|
|
2894
2809
|
@kindex info threads @r{[} terse | verbose@r{]}
|
2895
2810
|
@item info threads
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
@code{verbose} is given then the entire stack frame is shown. Here is
|
2901
|
-
an example:
|
2811
|
+
List information about currently-known threads. This information includes
|
2812
|
+
whether the thread is current (+), if it is suspended ($), or ignored (!); the
|
2813
|
+
thread number and the top stack item. If @code{verbose} is given then the entire
|
2814
|
+
stack frame is shown. Here it is an example:
|
2902
2815
|
|
2903
2816
|
@smallexample
|
2904
2817
|
(byebug:7) info threads
|
@@ -2951,32 +2864,27 @@ Local and instance variables.
|
|
2951
2864
|
@chapter Post-Mortem Debugging
|
2952
2865
|
@cindex post-mortem debugging
|
2953
2866
|
|
2954
|
-
It is also to possible enter byebug when you have an uncaught
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2958
|
-
work. However some commands, such as those which imply a continuation
|
2867
|
+
It is also to possible enter byebug when you have an uncaught exception that is
|
2868
|
+
about to terminate our program. This is called @emph{post-mortem debugging}. In
|
2869
|
+
this state many byebug commands for examining variables and moving around the
|
2870
|
+
stack still work. However some commands, such as those implying a continuation
|
2959
2871
|
of running code, no longer work.
|
2960
2872
|
|
2961
2873
|
The most reliable way to set up post-mortem debugging is to use the
|
2962
2874
|
@option{--post-mortem} option in invoking @code{byebug}. See @ref{byebug
|
2963
|
-
command-line options}. This traps/wraps at byebug ``load'' of
|
2964
|
-
|
2965
|
-
the
|
2966
|
-
|
2967
|
-
exception and continuing, but details of code in Ruby 1.8's
|
2968
|
-
@code{eval.c} prevent this.)
|
2875
|
+
command-line options}. This traps/wraps at byebug ``load'' of your Ruby script.
|
2876
|
+
When this is done, your program is stopped after the exception takes place, but
|
2877
|
+
before the stack has been unraveled. (Alas, it would be nice to if one could
|
2878
|
+
allow resetting the exception and continuing...)
|
2969
2879
|
|
2970
|
-
If however you haven't invoked @code{byebug} at the outset, but
|
2971
|
-
|
2972
|
-
|
2973
|
-
@code{Byebug.start}. Here's an example modified from
|
2974
|
-
@url{http://www.datanoise.com/articles/2006/12/20/post-mortem-debugging}:
|
2880
|
+
If however you haven't invoked @code{byebug} at the outset, but instead call
|
2881
|
+
@code{byebug} from inside your program, to set up post-mortem debugging set the
|
2882
|
+
@code{post_mortem} key in @code{Byebug.start}. Here's an example:
|
2975
2883
|
|
2976
2884
|
@smallexample
|
2977
2885
|
$ @b{cat t.rb }
|
2978
2886
|
require 'rubygems'
|
2979
|
-
require 'byebug' ; Byebug.start(:
|
2887
|
+
require 'byebug' ; Byebug.start(post_mortem: true)
|
2980
2888
|
|
2981
2889
|
def t1
|
2982
2890
|
raise 'test'
|
@@ -3488,117 +3396,13 @@ need to first call @samp{Byebug.start} before issuing this call.
|
|
3488
3396
|
|
3489
3397
|
@end table
|
3490
3398
|
|
3491
|
-
@node
|
3492
|
-
@appendix
|
3493
|
-
|
3494
|
-
Here are Unix-centric instructions. If you have Microsoft Windows or
|
3495
|
-
OSX some of the below may need adjusting.
|
3399
|
+
@node Contributing
|
3400
|
+
@appendix Guidelines for contributing
|
3496
3401
|
|
3497
3402
|
@menu
|
3498
|
-
* Prerequisites::
|
3499
|
-
* Package Checkout::
|
3500
|
-
* Trying Out::
|
3501
3403
|
* Running Regression Tests::
|
3502
|
-
* Building the Documentation and Emacs files::
|
3503
|
-
* Building for Microsoft Windows::
|
3504
3404
|
@end menu
|
3505
3405
|
|
3506
|
-
@node Prerequisites
|
3507
|
-
@section Prerequisites: To build the package you'll need at a minimum:
|
3508
|
-
|
3509
|
-
@itemize @bullet
|
3510
|
-
@item
|
3511
|
-
Ruby (of course). Currently only version 1.8.6 and above but not
|
3512
|
-
version 1.9.@emph{x} work.
|
3513
|
-
@item
|
3514
|
-
Ruby development headers. This typically includes a file called @file{ruby.h}
|
3515
|
-
@item
|
3516
|
-
A C compiler like GNU C (@code{gcc})
|
3517
|
-
@item
|
3518
|
-
Rake
|
3519
|
-
@item
|
3520
|
-
Subversion (@code{svn}).
|
3521
|
-
@end itemize
|
3522
|
-
|
3523
|
-
If you want to build the documentation and install Emacs files, you'll
|
3524
|
-
also need:
|
3525
|
-
|
3526
|
-
@itemize @bullet
|
3527
|
-
@item
|
3528
|
-
a POSIX shell like bash
|
3529
|
-
@item
|
3530
|
-
autoconf
|
3531
|
-
@item
|
3532
|
-
automake
|
3533
|
-
@item
|
3534
|
-
GNU Make
|
3535
|
-
@item
|
3536
|
-
texinfo
|
3537
|
-
@end itemize
|
3538
|
-
|
3539
|
-
@node Package Checkout
|
3540
|
-
@section Basic Package Checkout and Installation
|
3541
|
-
|
3542
|
-
Check out the trunk of repository following the instructions at
|
3543
|
-
@url{http://rubyforge.org/scm/?group_id=1900} For example on a Unixy system,
|
3544
|
-
this may work:
|
3545
|
-
|
3546
|
-
@smallexample
|
3547
|
-
mkdir byebug
|
3548
|
-
cd byebug
|
3549
|
-
svn checkout svn://rubyforge.org/var/svn/byebug/trunk trunk
|
3550
|
-
@end smallexample
|
3551
|
-
|
3552
|
-
In order to make the Ruby gems, @code{byebug} and
|
3553
|
-
@code{byebug-base}, get yourself into the trunk directory after
|
3554
|
-
the code has been checked out and run:
|
3555
|
-
|
3556
|
-
@smallexample
|
3557
|
-
cd trunk # This is the same trunk checked out above.
|
3558
|
-
rake package
|
3559
|
-
@end smallexample
|
3560
|
-
|
3561
|
-
If all goes well you should have some gem files put in the directory
|
3562
|
-
@code{pkg}. Use the gem command to install that.
|
3563
|
-
|
3564
|
-
@smallexample
|
3565
|
-
sudo gem install byebug-*.gem # See gem help for other possibilities
|
3566
|
-
@end smallexample
|
3567
|
-
|
3568
|
-
If all goes well byebug script has been installed byebug is
|
3569
|
-
now ready to run. But if everything goes well you might want to run
|
3570
|
-
the built-in regression tests to make sure everything is okay.
|
3571
|
-
See step 3 below.
|
3572
|
-
|
3573
|
-
If the gem install didn't work,'t there may be a problem with your C
|
3574
|
-
compiler or the Ruby headers are not installed.
|
3575
|
-
|
3576
|
-
@node Trying Out
|
3577
|
-
@section Trying Out without Installing
|
3578
|
-
|
3579
|
-
You don't have to build a gem file to try out ruby debug. In fact when
|
3580
|
-
developing new features for byebug, developers often you want to
|
3581
|
-
try it out @emph{before} installing. If you have a problem in the latter
|
3582
|
-
part of step 1 you may want to try this approach since we go into a
|
3583
|
-
little more detail as to what happens under the covers when you do the
|
3584
|
-
gem install.
|
3585
|
-
|
3586
|
-
Run (from trunk)
|
3587
|
-
@smallexample
|
3588
|
-
rake lib
|
3589
|
-
@end smallexample
|
3590
|
-
|
3591
|
-
This creates a Makefile and builds byebug shared library. (On
|
3592
|
-
Unix the name is @code{byebug.so}).
|
3593
|
-
|
3594
|
-
Once this is done you can run byebug as you would byebug using the
|
3595
|
-
script @code{runner.sh}. For example (again from trunk)
|
3596
|
-
|
3597
|
-
@smallexample
|
3598
|
-
./runner.sh ~/my-ruby-program.rb
|
3599
|
-
@end smallexample
|
3600
|
-
|
3601
|
-
@node Running Regression Tests
|
3602
3406
|
@section Running the Regression Tests
|
3603
3407
|
|
3604
3408
|
We've put together some basic tests to make sure byebug is doing
|
@@ -3613,87 +3417,13 @@ don't worry @code{rake test} will do step 2 for you. You should see a
|
|
3613
3417
|
line that ends something like:
|
3614
3418
|
|
3615
3419
|
@smallexample
|
3616
|
-
|
3617
|
-
|
3618
|
-
12 tests, 35 assertions, 0 failures, 0 errors
|
3619
|
-
@end smallexample
|
3620
|
-
|
3621
|
-
The number of seconds, tests, and assertions may be different from the
|
3622
|
-
above. However you @emph{should} see exactly ``0 failures, 0 errors.''
|
3623
|
-
|
3624
|
-
@node Building the Documentation and Emacs files
|
3625
|
-
@section Building the Documentation and Testing/Installing Emacs Files
|
3626
|
-
|
3627
|
-
Of course, I recommend you read byebug manual that comes with
|
3628
|
-
the package. If you have the prerequisites described above, run this
|
3629
|
-
once:
|
3630
|
-
@smallexample
|
3631
|
-
sh ./autogen.sh
|
3632
|
-
@end smallexample
|
3633
|
-
|
3634
|
-
Then run:
|
3635
|
-
@smallexample
|
3636
|
-
./configure
|
3637
|
-
make
|
3638
|
-
make test # Runs Emacs regression tests
|
3639
|
-
sudo make install # Or arrange to do this as root
|
3640
|
-
@end smallexample
|
3641
|
-
|
3642
|
-
@node Building for Microsoft Windows
|
3643
|
-
@section Building for Microsoft Windows
|
3644
|
-
|
3645
|
-
Microsoft Windows is ``special'' and building @code{byebug-base}
|
3646
|
-
on it requires extra care. A problem here seems to be that the
|
3647
|
-
``One-click'' install is compiled using Microsoft Visual Studio C, version 6
|
3648
|
-
which is not sold anymore and is rather old.
|
3649
|
-
|
3650
|
-
Instead I suggest building via mingw/msys.
|
3651
|
-
@url{http://eigenclass.org/hiki.rb?cmd=view&p=cross+compiling+rcovrt&key=mingw}
|
3652
|
-
has instructions on how to do. Some amendments to these instructions.
|
3653
|
-
|
3654
|
-
First, those instructions are a little GNU/Linux centric. If you are
|
3655
|
-
using Ubuntu or Debian, then this should be the easiest to follow the
|
3656
|
-
instructions. On Ubuntu or Debian there is a mingw3 Debian
|
3657
|
-
package. Installing that will give you the cross compiler that is a
|
3658
|
-
prerequisite. Alternatively if you are running MS Windows I notice
|
3659
|
-
that cygwin also has a mingw package. Or possibly you could use MinGW
|
3660
|
-
directly. For other OS's you might have to build a cross-compiler,
|
3661
|
-
i.e. gcc which emits win32 code and can create a win32 DLL.
|
3662
|
-
|
3663
|
-
After you have a cross compiler you need to download the Ruby source
|
3664
|
-
and basically build a ruby interpreter. The cross-compile.sh script
|
3665
|
-
works although when I downloaded it, it had lots of blank space at the
|
3666
|
-
beginning which will mess up the Unix magic interpretation. That is
|
3667
|
-
remove the blanks in front of @code{#/bin/sh}.
|
3668
|
-
|
3669
|
-
On my system, this script fails in running @code{make ruby} because the
|
3670
|
-
fake.rb that got created needed to have a small change:
|
3420
|
+
Finished tests in 2.839674s, 130.6488 tests/s, 141.9177 assertions/s.
|
3671
3421
|
|
3672
|
-
|
3673
|
-
ALT_SEPARATOR = "\"; \
|
3674
|
-
@end smallexample
|
3675
|
-
should be:
|
3676
|
-
@smallexample
|
3677
|
-
ALT_SEPARATOR = "\\"; \
|
3422
|
+
371 tests, 403 assertions, 0 failures, 0 errors, 25 skips
|
3678
3423
|
@end smallexample
|
3679
3424
|
|
3680
|
-
|
3681
|
-
@
|
3682
|
-
|
3683
|
-
And then @code{make install} as indicated.
|
3684
|
-
|
3685
|
-
Once all of that's in place, the place you want be is in
|
3686
|
-
@code{byebug/trunk/ext/win32}, not @code{byebug/ext}.
|
3687
|
-
|
3688
|
-
So let's say you've installed the cross-compiled install ruby in
|
3689
|
-
@code{/usr/local/ruby-mingw32/}. Here then are the commands to build @code{byebug-base-}@emph{xxx}@code{-mswin32.gem}:
|
3690
|
-
@smallexample
|
3691
|
-
cd .../byebug/trunk/ext/win32
|
3692
|
-
ruby -I /usr/local/ruby-mingw32/lib/ruby/1.8/i386-mingw32 ../extconf.rb
|
3693
|
-
make # Not rake
|
3694
|
-
cd ../.. # back in byebug/trunk
|
3695
|
-
rake win32_gem
|
3696
|
-
@end smallexample
|
3425
|
+
The number of seconds, tests, and assertions may be different from the above.
|
3426
|
+
However you @emph{should} see exactly ``0 failures, 0 errors.''
|
3697
3427
|
|
3698
3428
|
@node Class Module Method Index
|
3699
3429
|
@unnumbered Class, Module and Method Index
|
@@ -3708,8 +3438,7 @@ So let's say you've installed the cross-compiled install ruby in
|
|
3708
3438
|
@printindex cp
|
3709
3439
|
|
3710
3440
|
@tex
|
3711
|
-
% I think something like @colophon should be in texinfo. In the
|
3712
|
-
% meantime:
|
3441
|
+
% I think something like @colophon should be in texinfo. In the meantime:
|
3713
3442
|
\long\def\colophon{\hbox to0pt{}\vfill
|
3714
3443
|
\centerline{The body of this manual is set in}
|
3715
3444
|
\centerline{\fontname\tenrm,}
|