byebug 1.2.0 → 1.3.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/GUIDE.md +210 -4
- data/README.md +93 -64
- data/bin/byebug +10 -4
- data/byebug.gemspec +1 -1
- data/ext/byebug/breakpoint.c +22 -20
- data/lib/byebug/command.rb +5 -3
- data/lib/byebug/commands/frame.rb +2 -1
- data/lib/byebug/commands/kill.rb +0 -1
- data/lib/byebug/commands/set.rb +5 -6
- data/lib/byebug/commands/show.rb +11 -11
- data/lib/byebug/version.rb +1 -1
- data/logo.png +0 -0
- data/old_doc/byebug.texi +2 -2
- data/old_doc/{test-tri2.rb → test-triangle.rb} +4 -5
- data/old_doc/tri3.rb +3 -5
- data/old_doc/triangle.rb +4 -2
- data/test/breakpoints_test.rb +1 -2
- data/test/conditions_test.rb +3 -4
- data/test/continue_test.rb +6 -8
- data/test/display_test.rb +1 -2
- data/test/edit_test.rb +1 -2
- data/test/eval_test.rb +1 -2
- data/test/examples/stepping.rb +4 -0
- data/test/finish_test.rb +1 -2
- data/test/frame_test.rb +1 -2
- data/test/help_test.rb +1 -2
- data/test/info_test.rb +1 -2
- data/test/jump_test.rb +1 -2
- data/test/kill_test.rb +1 -2
- data/test/list_test.rb +1 -2
- data/test/method_test.rb +1 -2
- data/test/post_mortem_test.rb +1 -2
- data/test/quit_test.rb +1 -2
- data/test/reload_test.rb +1 -2
- data/test/repl_test.rb +1 -2
- data/test/restart_test.rb +1 -2
- data/test/save_test.rb +1 -2
- data/test/set_test.rb +6 -11
- data/test/show_test.rb +5 -4
- data/test/source_test.rb +1 -2
- data/test/stepping_test.rb +81 -55
- data/test/support/test_dsl.rb +54 -54
- data/test/test_helper.rb +0 -1
- data/test/trace_test.rb +75 -80
- data/test/variables_test.rb +1 -2
- metadata +6 -5
data/bin/byebug
CHANGED
@@ -25,7 +25,8 @@
|
|
25
25
|
# Show invocation help and exit.
|
26
26
|
#
|
27
27
|
#<tt>-I | --include</tt> <i>path</i>
|
28
|
-
# Add <i>path</i> to <tt>$LOAD_PATH</tt>
|
28
|
+
# Add <i>path</i> to <tt>$LOAD_PATH</tt>. Like the <tt>ruby -I</tt> command,
|
29
|
+
# it supports multiple load paths separated by colons.
|
29
30
|
#
|
30
31
|
#<tt>--keep-frame-binding</tt>::
|
31
32
|
# Keep frame bindings.
|
@@ -124,12 +125,14 @@ Usage: #{program} [options] <script.rb> -- <script.rb parameters>
|
|
124
125
|
EOB
|
125
126
|
opts.separator ""
|
126
127
|
opts.separator "Options:"
|
128
|
+
|
127
129
|
opts.on("-A", "--annotate LEVEL", Integer, "Set annotation level") {
|
128
130
|
|annotate| Byebug.annotate = annotate }
|
129
131
|
opts.on("-d", "--debug", "Set $DEBUG=true") {
|
130
132
|
$DEBUG = true }
|
131
|
-
opts.on('-I', '--include PATH', String,
|
132
|
-
|
133
|
+
opts.on('-I', '--include PATH', String,
|
134
|
+
'Add PATH (single or multiple:path:list) to $LOAD_PATH.') {
|
135
|
+
|path| $LOAD_PATH.unshift(*path.split(':')) }
|
133
136
|
opts.on('--no-quit', 'Do not quit when script finishes') {
|
134
137
|
options.quit = false }
|
135
138
|
opts.on('--no-rewrite-program', 'Don\'t set $0 to the program debugged') {
|
@@ -144,7 +147,8 @@ EOB
|
|
144
147
|
else
|
145
148
|
require name
|
146
149
|
end }
|
147
|
-
opts.on('--restart-script FILE', String,
|
150
|
+
opts.on('--restart-script FILE', String,
|
151
|
+
'Name of the script file to run. Erased after read') do
|
148
152
|
|restart_script|
|
149
153
|
options.restart_script = restart_script
|
150
154
|
unless File.exists?(options.restart_script)
|
@@ -162,6 +166,7 @@ EOB
|
|
162
166
|
end
|
163
167
|
opts.on('-x', '--trace', 'Turn on line tracing') {
|
164
168
|
options.tracing = true }
|
169
|
+
|
165
170
|
opts.separator ''
|
166
171
|
opts.separator 'Common options:'
|
167
172
|
opts.on_tail('--help', 'Show this message') do
|
@@ -197,6 +202,7 @@ rescue
|
|
197
202
|
end
|
198
203
|
|
199
204
|
opts = process_options(options)
|
205
|
+
|
200
206
|
begin
|
201
207
|
Byebug::ARGV = ARGV.clone if not defined? Byebug::ARGV
|
202
208
|
Byebug::BYEBUG_SCRIPT = File.expand_path(__FILE__)
|
data/byebug.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.add_development_dependency 'rake', '~> 10.0.4'
|
29
29
|
s.add_development_dependency 'rake-compiler', '~> 0.8.3'
|
30
30
|
s.add_development_dependency 'mocha', '~> 0.14.0'
|
31
|
-
s.add_development_dependency 'minitest', '~> 5.0.
|
31
|
+
s.add_development_dependency 'minitest', '~> 5.0.2'
|
32
32
|
|
33
33
|
s.license = "BSD"
|
34
34
|
end
|
data/ext/byebug/breakpoint.c
CHANGED
@@ -282,8 +282,8 @@ check_breakpoint_by_hit_condition(VALUE breakpoint_object)
|
|
282
282
|
|
283
283
|
if (breakpoint_object == Qnil)
|
284
284
|
return 0;
|
285
|
-
Data_Get_Struct(breakpoint_object, breakpoint_t, breakpoint);
|
286
285
|
|
286
|
+
Data_Get_Struct(breakpoint_object, breakpoint_t, breakpoint);
|
287
287
|
breakpoint->hit_count++;
|
288
288
|
|
289
289
|
if (Qtrue != breakpoint->enabled)
|
@@ -320,19 +320,17 @@ check_breakpoint_by_pos(VALUE breakpoint_object, char *file, int line)
|
|
320
320
|
{
|
321
321
|
breakpoint_t *breakpoint;
|
322
322
|
|
323
|
-
if(breakpoint_object == Qnil)
|
324
|
-
|
323
|
+
if (breakpoint_object == Qnil)
|
324
|
+
return 0;
|
325
|
+
|
325
326
|
Data_Get_Struct(breakpoint_object, breakpoint_t, breakpoint);
|
326
327
|
|
327
|
-
if (Qtrue != breakpoint->enabled)
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
if(filename_cmp(breakpoint->source, file))
|
334
|
-
return 1;
|
335
|
-
return 0;
|
328
|
+
if ( (Qtrue != breakpoint->enabled) ||
|
329
|
+
(breakpoint->type != BP_POS_TYPE) ||
|
330
|
+
(breakpoint->pos.line != line) )
|
331
|
+
return 0;
|
332
|
+
|
333
|
+
return filename_cmp(breakpoint->source, file);
|
336
334
|
}
|
337
335
|
|
338
336
|
static int
|
@@ -343,18 +341,18 @@ check_breakpoint_by_method(VALUE breakpoint_object, VALUE klass, ID mid,
|
|
343
341
|
|
344
342
|
if (breakpoint_object == Qnil)
|
345
343
|
return 0;
|
344
|
+
|
346
345
|
Data_Get_Struct(breakpoint_object, breakpoint_t, breakpoint);
|
347
346
|
|
348
|
-
if (
|
347
|
+
if ( (Qfalse == breakpoint->enabled) ||
|
348
|
+
(breakpoint->type != BP_METHOD_TYPE) ||
|
349
|
+
(breakpoint->pos.mid != mid) )
|
349
350
|
return 0;
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
return 0;
|
354
|
-
if (classname_cmp(breakpoint->source, klass))
|
355
|
-
return 1;
|
356
|
-
if ((rb_type(self) == T_CLASS) && classname_cmp(breakpoint->source, self))
|
351
|
+
|
352
|
+
if ( (classname_cmp(breakpoint->source, klass)) ||
|
353
|
+
((rb_type(self) == T_CLASS) && classname_cmp(breakpoint->source, self)) )
|
357
354
|
return 1;
|
355
|
+
|
358
356
|
return 0;
|
359
357
|
}
|
360
358
|
|
@@ -366,14 +364,18 @@ check_breakpoint_by_expr(VALUE breakpoint_object, VALUE binding)
|
|
366
364
|
|
367
365
|
if (breakpoint_object == Qnil)
|
368
366
|
return 0;
|
367
|
+
|
369
368
|
Data_Get_Struct(breakpoint_object, breakpoint_t, breakpoint);
|
370
369
|
|
371
370
|
if (Qtrue != breakpoint->enabled)
|
372
371
|
return 0;
|
372
|
+
|
373
373
|
if (NIL_P(breakpoint->expr))
|
374
374
|
return 1;
|
375
|
+
|
375
376
|
args = rb_ary_new3(2, breakpoint->expr, binding);
|
376
377
|
expr_result = rb_protect(eval_expression, args, 0);
|
378
|
+
|
377
379
|
return RTEST(expr_result);
|
378
380
|
}
|
379
381
|
|
data/lib/byebug/command.rb
CHANGED
@@ -40,8 +40,10 @@ module Byebug
|
|
40
40
|
"--\n" \
|
41
41
|
"List of \"#{cmd_name}\" subcommands:\n" \
|
42
42
|
"--\n"
|
43
|
+
width = subcmds.map(&:name).max_by(&:size).size
|
43
44
|
for subcmd in subcmds do
|
44
|
-
s +=
|
45
|
+
s += sprintf \
|
46
|
+
"%s %-#{width}s -- %s\n", cmd_name, subcmd.name, subcmd.short_help
|
45
47
|
end
|
46
48
|
return s
|
47
49
|
end
|
@@ -155,8 +157,8 @@ module Byebug
|
|
155
157
|
register_setting_var(:listsize, 10)
|
156
158
|
register_setting_var(:stack_trace_on_error, false)
|
157
159
|
register_setting_var(:tracing_plus, false)
|
158
|
-
|
159
|
-
|
160
|
+
cols = `stty size`.scan(/\d+/)[1].to_i
|
161
|
+
register_setting_var(:width, cols > 10 ? cols : 80)
|
160
162
|
Byebug::ARGV = ARGV.clone unless defined? Byebug::ARGV
|
161
163
|
register_setting_var(:argv, Byebug::ARGV)
|
162
164
|
|
@@ -167,7 +167,8 @@ module Byebug
|
|
167
167
|
def execute
|
168
168
|
print_backtrace
|
169
169
|
if truncated_callstack?(@state.context, Byebug.start_sentinal)
|
170
|
-
print
|
170
|
+
print \
|
171
|
+
"Warning: saved frames may be incomplete; compare with caller(0)\n"
|
171
172
|
end
|
172
173
|
end
|
173
174
|
|
data/lib/byebug/commands/kill.rb
CHANGED
data/lib/byebug/commands/set.rb
CHANGED
@@ -11,16 +11,16 @@ module Byebug
|
|
11
11
|
Subcommands =
|
12
12
|
[
|
13
13
|
['annotate', 2, false, 'Set annotation level',
|
14
|
-
'0 == normal
|
14
|
+
'0 == normal; ' \
|
15
15
|
'2 == output annotated suitably for use by programs that control ' \
|
16
|
-
'byebug
|
16
|
+
'byebug'],
|
17
17
|
['args', 2, false,
|
18
18
|
'Set argument list to give program being debugged when it is started'],
|
19
19
|
['autoeval', 4, true, 'Evaluate every unrecognized command'],
|
20
20
|
['autolist', 4, true, 'Execute "list" command on every breakpoint'],
|
21
21
|
['autoirb', 4, true, 'Invoke IRB on every stop'],
|
22
22
|
['autoreload', 4, true, 'Reload source code when changed'],
|
23
|
-
['basename', 1, true, 'Set filename display style
|
23
|
+
['basename', 1, true, 'Set filename display style'],
|
24
24
|
['callstyle', 2, false, 'Set how you want call parameters displayed'],
|
25
25
|
['testing', 2, false, 'Used when testing byebug'],
|
26
26
|
['forcestep', 2, true,
|
@@ -29,8 +29,8 @@ module Byebug
|
|
29
29
|
['history', 2, false,
|
30
30
|
'Generic command for setting command history parameters',
|
31
31
|
'set history filename -- Set the filename in which to record the ' \
|
32
|
-
'command history
|
33
|
-
'set history save -- Set saving of the history record on exit
|
32
|
+
'command history' \
|
33
|
+
'set history save -- Set saving of the history record on exit' \
|
34
34
|
'set history size -- Set the size of the command history'],
|
35
35
|
['linetrace+', 10, true,
|
36
36
|
'Set line execution tracing to show different lines'],
|
@@ -150,7 +150,6 @@ module Byebug
|
|
150
150
|
width = get_int(args[0], "Set width", 10, nil, 80)
|
151
151
|
return unless width
|
152
152
|
Command.settings[:width] = width
|
153
|
-
ENV['COLUMNS'] = width.to_s
|
154
153
|
else
|
155
154
|
return print "Unknown setting #{@match[1]}.\n"
|
156
155
|
end
|
data/lib/byebug/commands/show.rb
CHANGED
@@ -148,14 +148,14 @@ module Byebug
|
|
148
148
|
Subcommands =
|
149
149
|
[
|
150
150
|
['annotate', 2, 'Show annotation level',
|
151
|
-
'0 == normal;'
|
151
|
+
'0 == normal; ' \
|
152
152
|
'2 == output annotated suitably for use by programs that control ' \
|
153
|
-
'byebug
|
153
|
+
'byebug'],
|
154
154
|
['args', 2,
|
155
|
-
'Show argument list to give to the program being debugged when it ' \
|
156
|
-
'
|
157
|
-
'Follow this command with any number of args to be passed to the '
|
158
|
-
'program
|
155
|
+
'Show argument list to give to the program being debugged when it is' \
|
156
|
+
' started',
|
157
|
+
'Follow this command with any number of args to be passed to the ' \
|
158
|
+
'program'],
|
159
159
|
['autoeval', 4, 'Show whether unrecognized commands are evaluated'],
|
160
160
|
['autolist', 4, 'Show whether "list" command is run on stopping'],
|
161
161
|
['autoirb', 4, 'Show whether IRB is invoked on stopping'],
|
@@ -163,21 +163,21 @@ module Byebug
|
|
163
163
|
['basename', 1, 'Show whether basename is used when reporting files'],
|
164
164
|
['callstyle', 2, 'Show paramater style used when showing call frames'],
|
165
165
|
['commands', 2, 'Show the history of commands you typed',
|
166
|
-
'You can supply a command number to start with
|
166
|
+
'You can supply a command number to start with'],
|
167
167
|
['forcestep', 1, 'Show whether "next/step" force to move onto a new ' \
|
168
168
|
'line'],
|
169
169
|
['fullpath', 2, 'Show whether full paths are displayed in frames'],
|
170
170
|
['history', 2, 'Generic command to show command history parameters',
|
171
171
|
'show history filename -- Show the filename in which to record the ' \
|
172
|
-
'command history
|
172
|
+
'command history' \
|
173
173
|
'show history save -- Show whether history record should be saved ' \
|
174
|
-
'on exit
|
175
|
-
'show history size -- Show the size of the command history
|
174
|
+
'on exit' \
|
175
|
+
'show history size -- Show the size of the command history'],
|
176
176
|
['keep-frame-bindings', 1, 'Save frame binding on each call'],
|
177
177
|
['linetrace', 3, 'Show line execution tracing'],
|
178
178
|
['linetrace+', 10,
|
179
179
|
'Show whether different consecutive lines are shown in tracing'],
|
180
|
-
['listsize', 3, 'Show number of source lines to list by default
|
180
|
+
['listsize', 3, 'Show number of source lines to list by default'],
|
181
181
|
['port', 3, 'Show server port'],
|
182
182
|
['post-mortem', 3,
|
183
183
|
'Show whether we go into post-mortem debugging on an uncaught ' \
|
data/lib/byebug/version.rb
CHANGED
data/logo.png
ADDED
Binary file
|
data/old_doc/byebug.texi
CHANGED
@@ -2670,8 +2670,8 @@ ability to change that state inside byebug.
|
|
2670
2670
|
@table @code
|
2671
2671
|
@kindex set width @var{column-width}
|
2672
2672
|
@item set width @var{column-width}
|
2673
|
-
Set number of characters per line of byebug output.
|
2674
|
-
|
2673
|
+
Set number of characters per line of byebug output. By default it is the number
|
2674
|
+
of columns in the current terminal.
|
2675
2675
|
@kindex show width
|
2676
2676
|
@item show width
|
2677
2677
|
Shows the current width setting.
|
@@ -1,12 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require "rubygems"
|
5
|
-
require "byebug"
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative 'triangle.rb'
|
3
|
+
require 'byebug'
|
6
4
|
Byebug.start
|
7
5
|
|
8
6
|
class TestTri < Test::Unit::TestCase
|
9
7
|
def test_basic
|
8
|
+
require 'byebug'
|
10
9
|
byebug
|
11
10
|
solutions = []
|
12
11
|
0.upto(5) do |i|
|
data/old_doc/tri3.rb
CHANGED
data/old_doc/triangle.rb
CHANGED
data/test/breakpoints_test.rb
CHANGED
data/test/conditions_test.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
4
|
-
include TestDsl
|
3
|
+
class TestConditions < TestDsl::TestCase
|
5
4
|
|
6
5
|
describe 'setting condition' do
|
7
6
|
before { enter 'break 3' }
|
@@ -24,7 +23,7 @@ describe 'Conditions' do
|
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
describe '
|
26
|
+
describe 'unsuccessfully' do
|
28
27
|
before { enter 'break 4' }
|
29
28
|
|
30
29
|
it 'must not stop at the breakpoint if condition is false' do
|
@@ -53,7 +52,7 @@ describe 'Conditions' do
|
|
53
52
|
debug_file('conditions') { Byebug.breakpoints.first.expr.must_be_nil }
|
54
53
|
end
|
55
54
|
|
56
|
-
it 'must
|
55
|
+
it 'must unconditionally stop on the breakpoint' do
|
57
56
|
debug_file('conditions') { state.line.must_equal 3 }
|
58
57
|
end
|
59
58
|
end
|
data/test/continue_test.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
4
|
-
include TestDsl
|
3
|
+
class TestContinue < TestDsl::TestCase
|
5
4
|
|
6
5
|
describe "successful" do
|
7
6
|
it "must continue up to breakpoint if no line specified" do
|
@@ -19,12 +18,11 @@ describe "Continue Command" do
|
|
19
18
|
debug_file('continue') { state.line.must_equal 4 }
|
20
19
|
end
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
#end
|
21
|
+
it "must not keep temporal breakpoint when line specified" do
|
22
|
+
skip 'Not working yet, breakpoint is currently kept'
|
23
|
+
enter 'cont 4'
|
24
|
+
debug_file('continue') { Byebug.breakpoints.size.must_equal 0 }
|
25
|
+
end
|
28
26
|
end
|
29
27
|
|
30
28
|
describe "unsuccessful" do
|
data/test/display_test.rb
CHANGED
data/test/edit_test.rb
CHANGED
data/test/eval_test.rb
CHANGED
data/test/examples/stepping.rb
CHANGED