byebug 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Rakefile +0 -1
  4. data/bin/byebug +51 -114
  5. data/byebug.gemspec +1 -1
  6. data/ext/byebug/byebug.c +23 -106
  7. data/ext/byebug/byebug.h +10 -30
  8. data/ext/byebug/context.c +16 -102
  9. data/ext/byebug/extconf.rb +0 -9
  10. data/lib/byebug.rb +8 -122
  11. data/lib/byebug/command.rb +35 -29
  12. data/lib/byebug/commands/breakpoints.rb +17 -12
  13. data/lib/byebug/commands/catchpoint.rb +5 -5
  14. data/lib/byebug/commands/condition.rb +9 -7
  15. data/lib/byebug/commands/continue.rb +7 -4
  16. data/lib/byebug/commands/control.rb +4 -32
  17. data/lib/byebug/commands/display.rb +15 -14
  18. data/lib/byebug/commands/edit.rb +14 -13
  19. data/lib/byebug/commands/enable.rb +33 -35
  20. data/lib/byebug/commands/eval.rb +22 -29
  21. data/lib/byebug/commands/finish.rb +11 -9
  22. data/lib/byebug/commands/frame.rb +24 -50
  23. data/lib/byebug/commands/help.rb +21 -27
  24. data/lib/byebug/commands/info.rb +29 -92
  25. data/lib/byebug/commands/irb.rb +9 -11
  26. data/lib/byebug/commands/jump.rb +4 -4
  27. data/lib/byebug/commands/kill.rb +8 -8
  28. data/lib/byebug/commands/list.rb +2 -2
  29. data/lib/byebug/commands/method.rb +6 -6
  30. data/lib/byebug/commands/quit.rb +8 -8
  31. data/lib/byebug/commands/reload.rb +3 -3
  32. data/lib/byebug/commands/save.rb +10 -9
  33. data/lib/byebug/commands/set.rb +29 -26
  34. data/lib/byebug/commands/show.rb +17 -18
  35. data/lib/byebug/commands/skip.rb +8 -8
  36. data/lib/byebug/commands/source.rb +15 -13
  37. data/lib/byebug/commands/stepping.rb +7 -7
  38. data/lib/byebug/commands/trace.rb +8 -13
  39. data/lib/byebug/commands/variables.rb +18 -18
  40. data/lib/byebug/context.rb +3 -3
  41. data/lib/byebug/interface.rb +2 -7
  42. data/lib/byebug/processor.rb +9 -22
  43. data/lib/byebug/version.rb +1 -1
  44. data/old_doc/byebug.1 +3 -35
  45. data/old_doc/byebug.texi +69 -201
  46. data/old_doc/test-tri2.rb +1 -1
  47. data/test/breakpoints_test.rb +8 -1
  48. data/test/frame_test.rb +0 -8
  49. data/test/help_test.rb +13 -19
  50. data/test/info_test.rb +8 -32
  51. data/test/irb_test.rb +3 -4
  52. data/test/jump_test.rb +4 -4
  53. data/test/save_test.rb +2 -2
  54. data/test/set_test.rb +16 -8
  55. data/test/source_test.rb +10 -1
  56. data/test/support/context.rb +1 -1
  57. data/test/support/mocha_extensions.rb +16 -15
  58. data/test/support/test_dsl.rb +2 -2
  59. data/test/trace_test.rb +0 -45
  60. metadata +4 -10
  61. data/ext/byebug/locker.c +0 -53
  62. data/lib/byebug/commands/threads.rb +0 -190
  63. data/test/examples/frame_threads.rb +0 -31
  64. data/test/examples/info_threads.rb +0 -48
  65. data/test/examples/thread.rb +0 -32
  66. data/test/examples/trace_threads.rb +0 -20
@@ -34,11 +34,11 @@ module Byebug
34
34
  end
35
35
 
36
36
  class << self
37
- def help_command
38
- 'next'
37
+ def names
38
+ %w(next)
39
39
  end
40
40
 
41
- def help(cmd)
41
+ def description
42
42
  %{
43
43
  n[ext][+-]?[ nnn]\tstep over once or nnn times,
44
44
  \t\t'+' forces to move to another line.
@@ -62,16 +62,16 @@ module Byebug
62
62
  def execute
63
63
  steps, force = parse_stepping_args("Step", @match)
64
64
  return unless steps
65
- @state.context.step steps, force
65
+ @state.context.step_into steps, force
66
66
  @state.proceed
67
67
  end
68
68
 
69
69
  class << self
70
- def help_command
71
- 'step'
70
+ def names
71
+ %w(step)
72
72
  end
73
73
 
74
- def help(cmd)
74
+ def description
75
75
  %{
76
76
  s[tep][+-]?[ nnn]\tstep (into methods) once or nnn times
77
77
  \t\t'+' forces to move to another line.
@@ -1,5 +1,6 @@
1
1
  module Byebug
2
- class TraceCommand < Command # :nodoc:
2
+
3
+ class TraceCommand < Command
3
4
  def regexp
4
5
  /^\s* tr(?:ace)? (?: \s+ (\S+)) # on | off | var(iable)
5
6
  (?: \s+ (\S+))? # (all | variable-name)?
@@ -10,13 +11,8 @@ module Byebug
10
11
  def execute
11
12
  if @match[1] =~ /on|off/
12
13
  onoff = 'on' == @match[1]
13
- #if @match[2]
14
- Byebug.tracing = onoff
15
- print "Tracing is #{onoff ? 'on' : 'off'}\n"
16
- #else
17
- # Byebug.current_context.tracing = onoff
18
- # print "Tracing #{onoff ? 'on' : 'off'} on current thread.\n"
19
- #end
14
+ Byebug.tracing = onoff
15
+ print "Tracing is #{onoff ? 'on' : 'off'}\n"
20
16
  elsif @match[1] =~ /var(?:iable)?/
21
17
  varname=@match[2]
22
18
  if debug_eval("defined?(#{varname})")
@@ -39,14 +35,13 @@ module Byebug
39
35
  end
40
36
 
41
37
  class << self
42
- def help_command
43
- 'trace'
38
+ def names
39
+ %w(trace)
44
40
  end
45
41
 
46
- def help(cmd)
42
+ def description
47
43
  %{
48
- tr[ace] (on|off)\tset trace mode of current thread
49
- tr[ace] (on|off) all\tset trace mode of all threads
44
+ tr[ace] (on|off)\tset trace mode
50
45
  tr[ace] var(iable) VARNAME [stop|nostop]\tset trace variable on VARNAME
51
46
  }
52
47
  end
@@ -41,11 +41,11 @@ module Byebug
41
41
  end
42
42
 
43
43
  class << self
44
- def help_command
45
- 'var'
44
+ def names
45
+ %w(var)
46
46
  end
47
47
 
48
- def help(cmd)
48
+ def description
49
49
  %{
50
50
  v[ar] cl[ass] \t\t\tshow class variables of self
51
51
  }
@@ -74,11 +74,11 @@ module Byebug
74
74
  end
75
75
 
76
76
  class << self
77
- def help_command
78
- 'var'
77
+ def names
78
+ %w(var)
79
79
  end
80
80
 
81
- def help(cmd)
81
+ def description
82
82
  %{
83
83
  v[ar] co[nst] <object>\t\tshow constants of object
84
84
  }
@@ -96,11 +96,11 @@ module Byebug
96
96
  end
97
97
 
98
98
  class << self
99
- def help_command
100
- 'var'
99
+ def names
100
+ %w(var)
101
101
  end
102
102
 
103
- def help(cmd)
103
+ def description
104
104
  %{
105
105
  v[ar] g[lobal]\t\t\tshow global variables
106
106
  }
@@ -119,11 +119,11 @@ module Byebug
119
119
  end
120
120
 
121
121
  class << self
122
- def help_command
123
- 'var'
122
+ def names
123
+ %w(var)
124
124
  end
125
125
 
126
- def help(cmd)
126
+ def description
127
127
  %{
128
128
  v[ar] i[nstance] <object>\tshow instance variables of object
129
129
  }
@@ -146,11 +146,11 @@ module Byebug
146
146
  end
147
147
 
148
148
  class << self
149
- def help_command
150
- 'var'
149
+ def names
150
+ %w(var)
151
151
  end
152
152
 
153
- def help(cmd)
153
+ def description
154
154
  %{
155
155
  v[ar] l[ocal]\t\t\tshow local variables
156
156
  }
@@ -186,11 +186,11 @@ module Byebug
186
186
  end
187
187
 
188
188
  class << self
189
- def help_command
190
- 'var'
189
+ def names
190
+ %w(var)
191
191
  end
192
192
 
193
- def help(cmd)
193
+ def description
194
194
  %{
195
195
  v[ar] ct\t\t\tshow class heirarchy of object
196
196
  }
@@ -44,9 +44,9 @@ module Byebug
44
44
  handler.at_line(self, file, line)
45
45
  end
46
46
 
47
- def at_return(file, line)
48
- handler.at_return(self, file, line)
49
- end
47
+ #def at_return(file, line)
48
+ # handler.at_return(self, file, line)
49
+ #end
50
50
 
51
51
  end
52
52
  end
@@ -28,26 +28,21 @@ module Byebug
28
28
  def aprint(msg)
29
29
  print afmt(msg)
30
30
  end
31
-
32
31
  end
33
32
 
34
33
  class LocalInterface < Interface
35
34
  attr_accessor :command_queue, :history_length, :history_save, :histfile
36
35
  attr_accessor :restart_file
37
36
 
38
- unless defined?(FILE_HISTORY)
39
- FILE_HISTORY = ".byebug_hist"
40
- end
37
+ FILE_HISTORY = ".byebug_hist" unless defined?(FILE_HISTORY)
41
38
 
42
39
  def initialize()
43
40
  super
44
41
  @command_queue = []
45
42
  @have_readline = false
46
43
  @history_save = true
47
- # take gdb's default
48
44
  @history_length = ENV["HISTSIZE"] ? ENV["HISTSIZE"].to_i : 256
49
- @histfile = File.join(ENV["HOME"]||ENV["HOMEPATH"]||".",
50
- FILE_HISTORY)
45
+ @histfile = File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", FILE_HISTORY)
51
46
  open(@histfile, 'r') do |file|
52
47
  file.each do |line|
53
48
  line.chomp!
@@ -52,9 +52,9 @@ module Byebug
52
52
  @display = []
53
53
 
54
54
  @mutex = Mutex.new
55
- @last_cmd = nil
56
- @last_file = nil # Filename the last time we stopped
57
- @last_line = nil # line number the last time we stopped
55
+ @last_cmd = nil
56
+ @last_file = nil # Filename the last time we stopped
57
+ @last_line = nil # line number the last time we stopped
58
58
  @byebug_breakpoints_were_empty = false # Show breakpoints 1st time
59
59
  @byebug_displays_were_empty = true # No display 1st time
60
60
  @byebug_context_was_dead = true # Assume we haven't started.
@@ -92,8 +92,6 @@ module Byebug
92
92
  # FIXME: use annotations routines
93
93
  if Byebug.annotate.to_i > 2
94
94
  file_line = "\032\032source #{file_line}"
95
- #elsif ENV['EMACS']
96
- # file_line = "\032\032#{file_line}"
97
95
  end
98
96
  print file_line
99
97
  end
@@ -133,7 +131,6 @@ module Byebug
133
131
  aprint 'stopped' if Byebug.annotate.to_i > 2
134
132
  file = CommandProcessor.canonic_file(context.frame_file(0))
135
133
  line = context.frame_line(0)
136
- #print afmt("%s:%d" % [file, line]) if ENV['EMACS']
137
134
  print "Catchpoint at %s:%d: `%s' (%s)\n", file, line, excpt, excpt.class
138
135
  fs = context.stack_size
139
136
  tb = caller(0)[-fs..-1]
@@ -165,17 +162,12 @@ module Byebug
165
162
  end
166
163
  protect :at_line
167
164
 
168
- def at_return(context, file, line)
169
- #context.stop_frame = -1
170
- end
171
-
172
165
  private
173
-
174
166
  ##
175
167
  # Prompt shown before reading a command.
176
168
  #
177
169
  def prompt(context)
178
- p = '(byebug:%s) ' % (context.dead? ? 'post-mortem' : context.thnum)
170
+ p = "(byebug#{context.dead? ? ':post-mortem' : ''}) "
179
171
  p = afmt("pre-prompt")+p+"\n"+afmt("prompt") if Byebug.annotate.to_i > 2
180
172
  return p
181
173
  end
@@ -220,11 +212,8 @@ module Byebug
220
212
  #
221
213
  def process_commands(context, file, line)
222
214
  state, commands = always_run(context, file, line, 1)
223
- if Command.settings[:byebugtesting]
224
- $byebug_state = state
225
- else
226
- $byebug_state = nil
227
- end
215
+ $byebug_state = Command.settings[:testing] ? state : nil
216
+
228
217
  splitter = lambda do |str|
229
218
  str.split(/;/).inject([]) do |m, v|
230
219
  if m.empty?
@@ -248,11 +237,9 @@ module Byebug
248
237
  end
249
238
 
250
239
  while !state.proceed?
251
- input = if @interface.command_queue.empty?
252
- @interface.read_command(prompt(context))
253
- else
254
- @interface.command_queue.shift
255
- end
240
+ input = @interface.command_queue.empty? ?
241
+ @interface.read_command(prompt(context)) :
242
+ @interface.command_queue.shift
256
243
  break unless input
257
244
  catch(:debug_error) do
258
245
  if input == ""
@@ -1,3 +1,3 @@
1
1
  module Byebug
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -1,10 +1,10 @@
1
1
  .\" $Id: byebug.1 516 2007-12-31 05:55:24Z rockyb $
2
2
  .TH byebug 1
3
3
  .SH NAME
4
- byebug \- Fast Ruby byebug
4
+ byebug \- Fast Ruby debugger
5
5
  .SH SYNOPSIS
6
6
  .B byebug
7
- [byebug-options]
7
+ [byebug-options]
8
8
  byebug
9
9
  [script-options...]
10
10
  .SH "DESCRIPTION"
@@ -154,43 +154,18 @@ automatically when program state is changed. This can be used by
154
154
  front-ends such as GNU Emacs to post this updated information without
155
155
  having to poll for it.
156
156
  .TP
157
- .B \-\-client
158
- Connect to a remote byebug. Used with another byebug invocation using \-\-server.
159
- See also \-\-host and \-\-cport options
160
- .TP
161
- .B \-\-cport=PORT
162
- Port used for control commands.
163
- .TP
164
157
  .B \-d | \-\-debug
165
158
  Set $DEBUG true.
166
159
  .TP
167
- .B \-\-emacs
168
- Activates full GNU Emacs mode. Is the equivalent of setting the
169
- options \-\-emacs\-basic, \-\-annotate=3, \-\-no-stop, \-\-no\-control
170
- and \-\-post\-mortem.
171
- .TP
172
- .B \-\-emacs-basic
173
- Activates GNU Emacs mode. Byebug prompts are prefaced with two octal
174
- 032 characters.
175
- .TP
176
- .B \-h | \-\-host=HOST
177
- Host name used for remote debugging.
178
- .TP
179
160
  .B \-I | \-\-include PATH
180
161
  Add PATH to $LOAD_PATH
181
162
  .TP
182
163
  .B \-m | \-\-post-mortem
183
164
  Activate post-mortem mode.
184
165
  .TP
185
- .B \-\-no-control
186
- Do not automatically start control thread.
187
- .TP
188
166
  .B \-\-no\-stop
189
167
  Do not stop when script is loaded.
190
168
  .TP
191
- .B \-p | \-\-port=PORT
192
- Host name used for remote debugging.
193
- .TP
194
169
  .B \-r | \-\-require SCRIPT
195
170
  Require the library, before executing your script.
196
171
  .TP
@@ -222,20 +197,13 @@ Keep frame bindings.
222
197
  .TP
223
198
  .B \-\-script=FILE
224
199
  Name of the script file to run
225
- .B \-s | \-\-server
226
- Listen for remote connections. Another byebug session accesses using the \-\-client option.
227
- See also the \-\-host, \-\-port and
228
- \-\-cport options
229
- .TP
230
- .B \-w | \-\-wait
231
- Wait for a client connection, implies -s option.
232
200
  .TP
233
201
  .B \-\-help
234
202
  Show invocation help and exit.
235
203
  .PD
236
204
  .SH "SEE ALSO"
237
205
  .Sp
238
- https://github.com/cldwalker/byebug
206
+ https://github.com/deivid-rodriguez/byebug
239
207
  .SH AUTHOR
240
208
  byebug was written by Kent Siblev. This manual page was written by Rocky
241
209
  Bernstein <rocky@gnu.org>
@@ -195,13 +195,11 @@ definition but in Ruby line 4 is executed, the name @code{triangle} (probably)
195
195
  does not exist so issuing a method call of @code{triangle} will raise a
196
196
  ``method not found'' error.
197
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.
198
+ @code{byebug}'s prompt is @code{(byebug)}. If the program has died and you are
199
+ in post-mortem debugging @code{byebug:post-mortem} is used instead. If the
200
+ program has terminated normally, the string this position will be
201
+ @code{byebug:ctrl}. The commands which are available change depending on the
202
+ program's state.
205
203
 
206
204
  The first command, @code{list} (@pxref{List}), prints 10 lines centered around
207
205
  the current line; the current line here is line 4 and is marked by @code{=>}, so
@@ -844,8 +842,6 @@ candidate += 1
844
842
  The loop between lines 23--26 gets interleaved between those of
845
843
  @code{Sieve::next_prime}, lines 6--19 above.
846
844
 
847
- A similar kind of thing can occur when debugging programs with many threads.
848
-
849
845
  @node No Parameter Values in a Call Stack
850
846
  @subsection No Parameter Values in a Call Stack
851
847
  In traditional debuggers, in a call stack you can generally see the names of the
@@ -896,7 +892,6 @@ To be continued...
896
892
  @item line tracing and non-interactive tracing.
897
893
  @item mixing in Byebug.debug with byebug
898
894
  @item post-mortem debugging and setting up for that
899
- @item threading?
900
895
  @item references to videos
901
896
  @end itemize
902
897
  @end ifset
@@ -936,34 +931,25 @@ byebug @value{BYEBUG_VERSION}
936
931
  Usage: byebug [options] <script.rb> -- <script.rb parameters>
937
932
 
938
933
  Options:
939
- -A, --annotate LEVEL Set annotation level
940
- -c, --client Connect to remote byebug
941
- --cport PORT Port used for control commands
942
- -d, --debug Set $DEBUG=true
943
- --emacs Activates full Emacs support
944
- --emacs-basic Activates basic Emacs mode
945
- -h, --host HOST Host name used for remote debugging
946
- -I, --include PATH Add PATH to $LOAD_PATH
947
- --keep-frame-binding Keep frame bindings
948
- -m, --post-mortem Activate post-mortem mode
949
- --no-control Do not automatically start control thread
950
- --no-quit Do not quit when script finishes
951
- --no-rewrite-program Do not set $0 to the program being debugged
952
- --no-stop Do not stop when script is loaded
953
- -nx Not run byebug initialization files (e.g. .byebugrc
954
- -p, --port PORT Port used for remote debugging
955
- -r, --require SCRIPT Require the library, before executing your script
956
- --restart-script FILE Name of the script file to run. Erased after read
957
- --script FILE Name of the script file to run
958
- -s, --server Listen for remote connections
959
- -w, --wait Wait for a client connection, implies -s option
960
- -x, --trace Turn on line tracing
934
+ -A, --annotate LEVEL Set annotation level
935
+ -d, --debug Set $DEBUG=true
936
+ -I, --include PATH Add PATH to $LOAD_PATH
937
+ --keep-frame-binding Keep frame bindings
938
+ -m, --post-mortem Activate post-mortem mode
939
+ --no-quit Do not quit when script finishes
940
+ --no-rewrite-program Do not set $0 to the program being debugged
941
+ --no-stop Do not stop when script is loaded
942
+ -nx Don't run any initialization files like .byebugrc
943
+ -r, --require SCRIPT Require the library, before executing your script
944
+ --restart-script FILE Name of the script file to run. Erased after read
945
+ --script FILE Name of the script file to run
946
+ -x, --trace Turn on line tracing
961
947
 
962
948
  Common options:
963
- --verbose Turn on verbose mode
964
- --help Show this message
965
- --version Print the version
966
- -v Print version number, then turn on verbose mode
949
+ --verbose Turn on verbose mode
950
+ --help Show this message
951
+ --version Print the version
952
+ -v Print version number, then turn on verbose mode
967
953
  @end smallexample
968
954
 
969
955
  Options for the @code{byebug} are shown in the following list.
@@ -1004,23 +990,10 @@ Set gdb-style annotation @var{level}, a number. Additional information is output
1004
990
  automatically when program state is changed. This can be used by front-ends such
1005
991
  as GNU Emacs to post this updated information without having to poll for it.
1006
992
 
1007
- @item -c | --client
1008
- @cindex @option{-c}
1009
- @cindex @option{--client}
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.
1012
-
1013
- @item --cport @var{port}
1014
- @cindex @option{--cport} @var{port}
1015
- Port used for control commands.
1016
-
1017
993
  @item --debug
1018
994
  @cindex @option{--debug}
1019
995
  Set @code{$DEBUG} to @code{true}. This option is compatible with Ruby's.
1020
996
 
1021
- @item -h | --host @var{host-address}
1022
- Connect host address for remote debugging.
1023
-
1024
997
  @item -I --include @var{PATH}
1025
998
  @cindex @option{-I} @var{PATH}
1026
999
  @cindex @option{--include} @var{PATH}
@@ -1060,10 +1033,6 @@ If your program raises an exception that isn't caught you can enter byebug for
1060
1033
  inspection of what went wrong. You may also want to use this option in
1061
1034
  conjunction with @option{--no-stop}. See also @ref{Post-Mortem Debugging}.
1062
1035
 
1063
- @item --no-control
1064
- @cindex @option{--no-control}
1065
- Do not automatically start control thread.
1066
-
1067
1036
  @item --no-quit
1068
1037
  @cindex @option{--no-quit}
1069
1038
  Restart byebug when your program terminates normally.
@@ -1080,11 +1049,6 @@ Normally the @code{byebug} stops before executing the first statement. If
1080
1049
  instead you want it to start running initially and will perhaps break it later
1081
1050
  in the running, use this options.
1082
1051
 
1083
- @item -p | --port @var{port}
1084
- @cindex @option{-p} @var{port}
1085
- @cindex @option{--port} @var{port}
1086
- Port used for remote debugging.
1087
-
1088
1052
  @item -r | --require @var{library}
1089
1053
  @cindex @option{-r}
1090
1054
  @cindex @option{--require}
@@ -1098,18 +1062,6 @@ Require the library, before executing your script. However if the library
1098
1062
  happend to be @code{debug}, we'll just ignore the require (since we're already a
1099
1063
  debugger). This option is compatible with Ruby's.
1100
1064
 
1101
- @item -s | --server
1102
- @cindex @option{-s}
1103
- @cindex @option{--server}
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}.
1106
-
1107
- @item -w | --wait
1108
- @cindex @option{-w}
1109
- @cindex @option{--wait}
1110
- Debug the program but stop waiting for a client connection first. This option
1111
- automatically sets @option{--server} option.
1112
-
1113
1065
  @item -x | --trace
1114
1066
  @cindex @option{-x}
1115
1067
  @cindex @option{--trace}
@@ -1365,10 +1317,9 @@ parameters.
1365
1317
  @node Command Output
1366
1318
  @section Command Output
1367
1319
  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}.
1320
+ presents a prompt of the form @code{(byebug)}. If the program has terminated
1321
+ normally the prompt will be @code{(byebug:ctrl)} and in post-mortem debugging it
1322
+ will be @code{(byebug:post-mortem)}.
1372
1323
 
1373
1324
  In the local interface, whenever @code{byebug} gives an error message such as
1374
1325
  for an invalid command, or an invalid location position, it will generally
@@ -1400,7 +1351,7 @@ byebug help v@value{BYEBUG_VERSION}
1400
1351
  Type 'help <command-name>' for help on a specific command
1401
1352
 
1402
1353
  Available commands:
1403
- backtrace delete enable help list ps save thread where
1354
+ backtrace delete enable help list ps save where
1404
1355
  break disable eval info method putl set trace
1405
1356
  catch display exit irb next quit show undisplay
1406
1357
  condition down finish jump p reload source up
@@ -1461,8 +1412,6 @@ info line -- Line number and file name of current position in source file
1461
1412
  info locals -- Local variables of the current stack frame
1462
1413
  info program -- Execution status of the program
1463
1414
  info stack -- Backtrace of the stack
1464
- info thread -- List info about thread NUM
1465
- info threads -- information of currently-known threads
1466
1415
  info variables -- Local and instance variables of the current stack frame
1467
1416
  @end example
1468
1417
 
@@ -1501,8 +1450,7 @@ With an integer argument, list info on that breakpoint.
1501
1450
  @itemx q
1502
1451
 
1503
1452
  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.
1453
+ alias @code{exit}.
1506
1454
 
1507
1455
  Normally if you are in an interactive session, this command will prompt to ask
1508
1456
  if you really want to quit. If you don't want any questions asked, enter
@@ -1529,17 +1477,6 @@ Also, since this relies on the the OS @code{exec} call, this command is
1529
1477
  available only if your OS supports @code{exec}; OSX for example does not (yet).
1530
1478
  @end table
1531
1479
 
1532
- @node Interrupt
1533
- @subsection Interrupt (@samp{interrupt})
1534
-
1535
- @table @code
1536
- @kindex interrupt
1537
- @kindex i
1538
- @item interrupt
1539
- @itemx i
1540
- Interrupt the program. Useful if there are multiple threads running.
1541
- @end table
1542
-
1543
1480
  @node Source
1544
1481
  @subsection Running Byebug Commands (@samp{source})
1545
1482
 
@@ -2066,9 +2003,9 @@ a resynchronization if there is a front end also watching over things.
2066
2003
  @end table
2067
2004
 
2068
2005
  @table @code
2069
- @kindex frame @r{[}@ovar{n} @r{[}thread @var{thread-num}@r{]}@r{]}
2006
+ @kindex frame @r{[} @ovar{n}@r{]}
2070
2007
  @cindex current stack frame
2071
- @item frame @ovar{n} @r{[}thread @var{thread-num}@r{]}
2008
+ @item frame@r{[} @ovar{n}@r{]}
2072
2009
  The @code{frame} command allows you to move from one stack frame to another, and
2073
2010
  to print the stack frame you select. @var{n} is the the stack frame number or 0
2074
2011
  if no frame number is given; @code{frame 0} then will always show the current
@@ -2081,9 +2018,6 @@ stack frame.
2081
2018
  Without an argument, @code{frame} prints the current stack frame. Since the
2082
2019
  current position is redisplayed, it may trigger a resynchronization if there is
2083
2020
  a front end also watching over things.
2084
-
2085
- If a thread number is given then we set the context for evaluating expressions
2086
- to that frame of that thread.
2087
2021
  @end table
2088
2022
 
2089
2023
  @node Stopping
@@ -2797,64 +2731,6 @@ and @code{to_s} method is called.
2797
2731
  @item info stack
2798
2732
  Backtrace of the stack. An alias for @code{where}. @xref{Backtrace}.
2799
2733
 
2800
- @kindex info thread
2801
- @item info thread @ovar{thread-number} @r{[} terse | verbose@r{]}
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.
2808
-
2809
- @kindex info threads @r{[} terse | verbose@r{]}
2810
- @item info threads
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:
2815
-
2816
- @smallexample
2817
- (byebug:7) info threads
2818
- 1 #<Thread:0xb7d08704 sleep> ./test/thread1.rb:27
2819
- !2 #<Byebug::DebugThread:0xb7782e4c sleep>
2820
- 3 #<Thread:0xb777e220 sleep> ./test/thread1.rb:11
2821
- 4 #<Thread:0xb777e144 sleep> ./test/thread1.rb:11
2822
- 5 #<Thread:0xb777e07c sleep> ./test/thread1.rb:11
2823
- 6 #<Thread:0xb777dfb4 sleep> ./test/thread1.rb:11
2824
- + 7 #<Thread:0xb777deec run> ./test/thread1.rb:14
2825
- (byebug:1)
2826
- @end smallexample
2827
-
2828
- Thread 7 is the current thread since it has a plus sign in front. Thread 2 is
2829
- ignored since it has a @code{!}. A ``verbose'' listing of the above:
2830
-
2831
- @smallexample
2832
- (byebug:7) info threads verbose
2833
- 1 #<Thread:0xb7d08704 sleep>
2834
- #0 Integer.join at test/thread1.rb:27
2835
- #1 at test/thread1.rb:27
2836
- !2 #<Byebug::DebugThread:0xb7782e4c sleep>
2837
- 3 #<Thread:0xb777e220 sleep>
2838
- #0 sleep(count#Fixnum) at test/thread1.rb:11
2839
- #1 Object.fn(count#Fixnum, i#Fixnum) at test/thread1.rb:11
2840
- #2 at test/thread1.rb:23
2841
- 4 #<Thread:0xb777e144 sleep>
2842
- #0 sleep(count#Fixnum) at test/thread1.rb:11
2843
- #1 Object.fn(count#Fixnum, i#Fixnum) at test/thread1.rb:11
2844
- #2 at test/thread1.rb:23
2845
- 5 #<Thread:0xb777e07c sleep>
2846
- #0 sleep(count#Fixnum) at test/thread1.rb:11
2847
- #1 Object.fn(count#Fixnum, i#Fixnum) at test/thread1.rb:11
2848
- #2 at test/thread1.rb:23
2849
- 6 #<Thread:0xb777dfb4 sleep>
2850
- #0 sleep(count#Fixnum) at test/thread1.rb:11
2851
- #1 Object.fn(count#Fixnum, i#Fixnum) at test/thread1.rb:11
2852
- #2 at test/thread1.rb:23
2853
- + 7 #<Thread:0xb777deec run>
2854
- #0 Object.fn(count#Fixnum, i#Fixnum) at test/thread1.rb:14
2855
- #1 at test/thread1.rb:23
2856
- @end smallexample
2857
-
2858
2734
  @kindex info variables
2859
2735
  @item info variables
2860
2736
  Local and instance variables.
@@ -2965,21 +2841,18 @@ be @code{(byebug:post-mortem)}.
2965
2841
  @node Byebug.run
2966
2842
  @subsection @code{Byebug.start}, @code{Byebug.started?}, @code{Byebug.stop}, @code{Byebug.run_script}
2967
2843
 
2968
- In order to provide better debugging information regarding the stack
2969
- frame(s) across all threads, byebug has to intercept each call,
2970
- save some information and on return remove it. Possibly, in Ruby 1.9
2971
- possibly this will not be needed. Therefore one has to issue call to
2972
- indicate start saving information and another call to stop. Of course,
2973
- If you call byebug from the outset via @code{byebug} this is done
2974
- for you.
2844
+ In order to provide better debugging information regarding the stack frame(s),
2845
+ byebug has to intercept each call, save some information and on return remove
2846
+ it. Therefore one has to issue a call to indicate byebug to start saving
2847
+ information and another call to stop. Of course, if you call byebug from the
2848
+ outset via @code{byebug} this is done for you.
2975
2849
 
2976
2850
  @table @code
2977
2851
  @item Byebug.start(@ovar{options}) @ovar{block}
2978
2852
  @vindex @code{Byebug.start(options)}
2979
2853
  @vindex @code{Byebug.start(block)}
2980
2854
  Turn on add additional instrumentation code to facilitate debugging. A
2981
- system even table hook is installed and some variables are set up to
2982
- access thread frames.
2855
+ system even table hook is installed and some variables are set up.
2983
2856
 
2984
2857
  This needs to be done before entering byebug; therefore a call
2985
2858
  to byebug issue a @code{Byebug.start} call if necessary.
@@ -3105,7 +2978,7 @@ Fixnum: 1 if on or 0 if off.
3105
2978
  Boolean. True if basename on. @xref{Basename}.
3106
2979
  @item :callstyle
3107
2980
  Symbol: @code{:short} or @code{:last}. @xref{Callstyle}.
3108
- @item :byebugtesting
2981
+ @item :testing
3109
2982
  Boolean. True if currently testing byebug.
3110
2983
  @item :force_stepping
3111
2984
  Boolean. True if stepping should go to a line different from the last
@@ -3254,33 +3127,32 @@ another one. If it does, it's undefined which one will get matched and run.
3254
3127
  In addition the instance needs these methods:
3255
3128
  @table @code
3256
3129
  @item execute
3257
- Code which gets run when you type a command (string) that matches the commands
3130
+ Code which gets run when you type a command (string) that matches the command's
3258
3131
  regular expression.
3259
- @item help
3132
+ @item description
3260
3133
  A string which gets displayed when folks ask for help on that command.
3261
- @item help_command
3262
- A name the help system uses to show what commands are available.
3134
+ @item names
3135
+ Names and aliases of the command as an array of strings.
3263
3136
  @end table
3264
3137
 
3265
3138
  Here's a small example of a new command:
3266
3139
  @smallexample
3267
3140
  module Byebug
3268
3141
  class MyCommand < Command
3269
- def regexp
3270
- /^\s*me$/ # Regexp that will match your command
3271
- end
3142
+ def regexp
3143
+ /^\s*me$/ # Regexp that will match your command
3144
+ end
3272
3145
 
3273
- def execute
3274
- puts "hi" # What you want to happen when your command runs
3275
- end
3276
- class << self
3277
- def help_command
3278
- 'me' # String name of command
3146
+ def execute
3147
+ puts "hi" # What you want to happen when your command runs
3279
3148
  end
3280
- def help(cmd)
3281
- # Some sort of help text.
3282
- %@{This does whatever it is I want to do@}
3283
- end
3149
+ class << self
3150
+ def names
3151
+ %w(me)
3152
+ end
3153
+ def description
3154
+ %@{This does whatever it is I want to do@}
3155
+ end
3284
3156
  end
3285
3157
  end
3286
3158
  @end smallexample
@@ -3302,14 +3174,14 @@ ruby /tmp/testit.rb:
3302
3174
  /tmp/testit.rb:7
3303
3175
  y=2
3304
3176
  (byebug:1) help
3305
- byebug help v0.10.3
3177
+ byebug help v1.1.0
3306
3178
  Type 'help <command-name>' for help on a specific command
3307
3179
  Available commands:
3308
3180
  backtrace delete enable help method putl set trace
3309
3181
  break disable eval info next quit show undisplay
3310
3182
  catch display exit irb p reload source up
3311
3183
  condition down finish list pp restart step var
3312
- continue edit frame me ps save thread where
3184
+ continue edit frame me ps save where
3313
3185
  ^^ This is you
3314
3186
 
3315
3187
  (byebug:1) help me
@@ -3326,8 +3198,8 @@ hi
3326
3198
 
3327
3199
  @item byebug @ovar{steps=1}
3328
3200
  @vindex @code{Kernel::byebug}
3329
- Enters byebug in the current thread after a stepping @var{steps} line-event
3330
- steps. Before entering byebug startup script is read.
3201
+ Enters byebug after @var{steps} line-event steps. Before entering byebug, the
3202
+ startup script is read.
3331
3203
 
3332
3204
  Setting @var{steps} to 0 will cause a break in byebug subroutine and not wait
3333
3205
  for any line event to occur. This could be useful you want to stop right after
@@ -3336,16 +3208,14 @@ the last statement in some scope.
3336
3208
  Consider this example:
3337
3209
  @smallexample
3338
3210
  $ cat scope-test.rb
3339
-
3340
- require 'rubygems'
3341
3211
  require 'byebug' ; Byebug.start
3342
3212
  1.times do
3343
- a = 1
3344
- byebug # implied steps=1
3345
- end
3213
+ a = 1
3214
+ byebug # implied steps=1
3215
+ end
3346
3216
  y = 1
3347
3217
 
3348
- $ scope-test.rb:8
3218
+ $ ruby scope-test.rb
3349
3219
  y = 1
3350
3220
  (byebug:1) p a
3351
3221
  NameError Exception: undefined local variable or method `a' for main:Object
@@ -3354,13 +3224,11 @@ NameError Exception: undefined local variable or method `a' for main:Object
3354
3224
 
3355
3225
  Byebug will stop at the line event which follows @samp{a=1}. This is outside the
3356
3226
  @code{do} block scope where @var{a} is defined. If instead you want to stop
3357
- before leaving the @code{do} loop it is possibly to stop right inside
3358
- @code{byebug}; call with 0 zero parameter:
3227
+ before leaving the @code{do} loop it is possible to stop right inside
3228
+ @code{byebug}; call byebug with 0 zero parameter:
3359
3229
 
3360
3230
  @smallexample
3361
3231
  $ cat scope-test.rb
3362
-
3363
- require 'rubygems'
3364
3232
  require 'byebug' ; Byebug.start
3365
3233
  1.times do
3366
3234
  a = 1
@@ -3368,15 +3236,15 @@ require 'byebug' ; Byebug.start
3368
3236
  end
3369
3237
  y = 1
3370
3238
 
3371
- $ scope-test.rb:8
3239
+ $ ruby scope-test.rb
3372
3240
  ../lib/byebug.rb:386
3373
- Byebug.current_context.stop_frame = 0
3241
+ Byebug.context.stop_frame = 0
3374
3242
  (byebug:1) where
3375
3243
  --> #0 Kernel.byebug(steps#Fixnum) at ../lib/byebug-base.rb:386
3376
- #1 at scope-test.rb:6
3377
- #2 at scope-test.rb:4
3244
+ #1 at scope-test.rb:4
3245
+ #2 at scope-test.rb:2
3378
3246
  (byebug:1) up
3379
- #1 at scope-test.rb:6
3247
+ #1 at scope-test.rb:4
3380
3248
  (byebug:1) p a
3381
3249
  1
3382
3250
  (byebug:1)
@@ -3417,9 +3285,9 @@ don't worry @code{rake test} will do step 2 for you. You should see a
3417
3285
  line that ends something like:
3418
3286
 
3419
3287
  @smallexample
3420
- Finished tests in 2.839674s, 130.6488 tests/s, 141.9177 assertions/s.
3288
+ Finished tests in 2.358177s, 155.2046 tests/s, 172.1669 assertions/s.
3421
3289
 
3422
- 371 tests, 403 assertions, 0 failures, 0 errors, 25 skips
3290
+ 366 tests, 406 assertions, 0 failures, 0 errors, 17 skips
3423
3291
  @end smallexample
3424
3292
 
3425
3293
  The number of seconds, tests, and assertions may be different from the above.