byebug 3.5.0 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e311c958672db924c18ba6c50b079b8d0b02071
4
- data.tar.gz: 9b5b874f7334cf8f2de778c6587d87717b79b780
3
+ metadata.gz: 93b7b0bff9694ec5f6674d3e7c7aa3de420cc0f9
4
+ data.tar.gz: ed65140ba0ef5b5f84253e0980938ffa84739c40
5
5
  SHA512:
6
- metadata.gz: 6804f3c19226009adecad6208753584bf3b9364e290c70b7be4e3ae92a8d7e300f4f6bb5a2aec029b7c3ac9df4ded55efa144ff7fff530364fec7d7058f42b10
7
- data.tar.gz: 25f86abebed81ad2667b6fea393c8f4404d46d2556688fa900da8e5c5c45a223485eadab5ec0f599d9a62f978b597f379b625d182649ce7b95fa8cf0687980a9
6
+ metadata.gz: c88d13966721950651f3713cbca994af3d70d11c0337e48c46c5bc364220835b3908ceb69be70b962356495a00118e7f4fdbc66ff7f8b504ebdd7931b48151c3
7
+ data.tar.gz: 579d418f58bab70f03c0deafa48695b5879d64590b84732b619891c5cc45b217111f2388b10db5b8de2c6dd9dddd0ee482a4804344419ed9409bb1f7202169c4
@@ -1,3 +1,9 @@
1
+ # 3.5.1
2
+ - Fix windows installation (#79)
3
+ - Fix bug in "condition" command where invalid breakpoint ids wouldn't be
4
+ properly detected.
5
+
6
+
1
7
  # 3.5.0
2
8
  - Bugfixes
3
9
  * Fix #81, byebug's history does not mess with other programs that use
@@ -18,6 +18,45 @@ VALUE locker = Qnil;
18
18
  /* Hash table with active threads and their associated contexts */
19
19
  VALUE threads = Qnil;
20
20
 
21
+ /*
22
+ * call-seq:
23
+ * Byebug.breakpoints -> array
24
+ *
25
+ * Returns an array of breakpoints.
26
+ */
27
+ static VALUE
28
+ bb_breakpoints(VALUE self)
29
+ {
30
+ if (NIL_P(breakpoints))
31
+ breakpoints = rb_ary_new();
32
+
33
+ return breakpoints;
34
+ }
35
+
36
+ /*
37
+ * call-seq:
38
+ * Byebug.catchpoints -> array
39
+ *
40
+ * Returns an array of catchpoints.
41
+ */
42
+ static VALUE
43
+ bb_catchpoints(VALUE self)
44
+ {
45
+ return catchpoints;
46
+ }
47
+
48
+ /*
49
+ * call-seq:
50
+ * Byebug.raised_exception -> exception
51
+ *
52
+ * Returns raised exception when in post_mortem mode.
53
+ */
54
+ static VALUE
55
+ bb_raised_exception(VALUE self)
56
+ {
57
+ return raised_exception;
58
+ }
59
+
21
60
  #define IS_STARTED (catchpoints != Qnil)
22
61
  static void
23
62
  check_started()
@@ -182,7 +221,7 @@ call_at_line_check(VALUE context_obj, debug_context_t *dc,
182
221
  static void
183
222
  line_event(VALUE trace_point, void *data)
184
223
  {
185
- VALUE breakpoint, file, line, binding;
224
+ VALUE breakpoint, file, line, binding, self;
186
225
  int moved = 0;
187
226
 
188
227
  EVENT_SETUP
@@ -191,6 +230,7 @@ line_event(VALUE trace_point, void *data)
191
230
  file = rb_tracearg_path(trace_arg);
192
231
  line = rb_tracearg_lineno(trace_arg);
193
232
  binding = rb_tracearg_binding(trace_arg);
233
+ self = rb_tracearg_self(trace_arg);
194
234
 
195
235
  EVENT_COMMON
196
236
 
@@ -223,7 +263,7 @@ line_event(VALUE trace_point, void *data)
223
263
  if (dc->steps == 0 || dc->lines == 0 ||
224
264
  (CTX_FL_TEST(dc, CTX_FL_ENABLE_BKPT) &&
225
265
  (!NIL_P(
226
- breakpoint = find_breakpoint_by_pos(breakpoints, file, line, binding)))))
266
+ breakpoint = find_breakpoint_by_pos(bb_breakpoints(self), file, line, binding)))))
227
267
  {
228
268
  call_at_line_check(context, dc, breakpoint, file, line);
229
269
  }
@@ -254,7 +294,7 @@ call_event(VALUE trace_point, void *data)
254
294
  file = rb_tracearg_path(trace_arg);
255
295
  line = rb_tracearg_lineno(trace_arg);
256
296
 
257
- breakpoint = find_breakpoint_by_method(breakpoints, klass, mid, binding, self);
297
+ breakpoint = find_breakpoint_by_method(bb_breakpoints(self), klass, mid, binding, self);
258
298
  if (breakpoint != Qnil)
259
299
  {
260
300
  call_at_breakpoint(context, dc, breakpoint);
@@ -578,7 +618,6 @@ bb_start(VALUE self)
578
618
  else
579
619
  {
580
620
  locker = Qnil;
581
- breakpoints = rb_ary_new();
582
621
  catchpoints = rb_hash_new();
583
622
  threads = create_threads_table();
584
623
 
@@ -713,33 +752,6 @@ bb_set_post_mortem(VALUE self, VALUE value)
713
752
  return value;
714
753
  }
715
754
 
716
- /*
717
- * call-seq:
718
- * Byebug.breakpoints -> array
719
- *
720
- * Returns an array of breakpoints.
721
- */
722
- static VALUE
723
- bb_breakpoints(VALUE self)
724
- {
725
- if (NIL_P(breakpoints))
726
- breakpoints = rb_ary_new();
727
-
728
- return breakpoints;
729
- }
730
-
731
- /*
732
- * call-seq:
733
- * Byebug.catchpoints -> array
734
- *
735
- * Returns an array of catchpoints.
736
- */
737
- static VALUE
738
- bb_catchpoints(VALUE self)
739
- {
740
- return catchpoints;
741
- }
742
-
743
755
  /*
744
756
  * call-seq:
745
757
  * Byebug.add_catchpoint(exception) -> exception
@@ -756,18 +768,6 @@ bb_add_catchpoint(VALUE self, VALUE value)
756
768
  return value;
757
769
  }
758
770
 
759
- /*
760
- * call-seq:
761
- * Byebug.raised_exception -> exception
762
- *
763
- * Returns raised exception when in post_mortem mode.
764
- */
765
- static VALUE
766
- bb_raised_exception(VALUE self)
767
- {
768
- return raised_exception;
769
- }
770
-
771
771
  /*
772
772
  * Document-class: Byebug
773
773
  *
@@ -17,10 +17,12 @@ module Byebug
17
17
  breakpoints = Byebug.breakpoints.sort_by { |b| b.id }
18
18
  return errmsg('No breakpoints have been set') unless breakpoints.any?
19
19
 
20
- pos, err = get_int(@match[1], 'Condition', 1, breakpoints.last.id)
21
- return errmsg(err) unless pos
20
+ pos, err = get_int(@match[1], 'Condition', 1)
21
+ return errmsg(err) if err
22
22
 
23
- breakpoint = breakpoints.select { |b| b.id == pos }.first
23
+ breakpoint = breakpoints.find { |b| b.id == pos }
24
+ return errmsg('Invalid breakpoint id. Use "info breakpoint" to find ' \
25
+ 'out the correct id') unless breakpoint
24
26
 
25
27
  return errmsg("Incorrect expression \"#{@match[2]}\", " \
26
28
  'breakpoint not changed') unless syntax_valid?(@match[2])
@@ -68,7 +68,7 @@ module Byebug
68
68
  # @return last line number to list
69
69
  #
70
70
  def set_range(size, max_line)
71
- first = amend(lower(size, @match[1] || '+'), size, max_line - size + 1)
71
+ first = amend(lower(size, @match[1] || '+'), max_line - size + 1)
72
72
 
73
73
  [first, move(first, size - 1)]
74
74
  end
@@ -78,10 +78,10 @@ module Byebug
78
78
  return [-1, -1] if err
79
79
 
80
80
  if input.split(/[-,]/)[1]
81
- last, err = get_int(input.split(/[-,]/)[1], 'List', 1, max_line)
81
+ last, _ = get_int(input.split(/[-,]/)[1], 'List', 1, max_line)
82
82
  return [-1, -1] unless last
83
83
 
84
- last = amend(last, size, max_line)
84
+ last = amend(last, max_line)
85
85
  else
86
86
  first -= (size / 2)
87
87
  end
@@ -89,7 +89,7 @@ module Byebug
89
89
  [first, last || move(first, size - 1)]
90
90
  end
91
91
 
92
- def amend(line, size, max_line)
92
+ def amend(line, max_line)
93
93
  return 1 if line < 1
94
94
 
95
95
  [max_line, line].min
@@ -111,7 +111,7 @@ module Byebug
111
111
  def display_lines(min, max, lines)
112
112
  puts "\n[#{min}, #{max}] in #{@state.file}"
113
113
 
114
- (min..max).to_a.zip(lines[min-1..max-1]).map do |l|
114
+ (min..max).to_a.zip(lines[min - 1..max - 1]).map do |l|
115
115
  mark = l[0] == @state.line ? '=> ' : ' '
116
116
  puts format("#{mark}%#{max.to_s.size}d: %s", l[0], l[1])
117
117
  end
@@ -1,4 +1,7 @@
1
1
  module Byebug
2
+ #
3
+ # Miscelaneous Utilities
4
+ #
2
5
  module MiscUtils
3
6
  #
4
7
  # Cross-platform way of finding an executable in the $PATH.
@@ -20,7 +23,7 @@ module Byebug
20
23
  end
21
24
 
22
25
  #
23
- # Miscelaneous Utilities
26
+ # Utilities to assist command parsing
24
27
  #
25
28
  module ParseFunctions
26
29
  #
@@ -24,7 +24,7 @@ module Byebug
24
24
  # Saves history to disk.
25
25
  #
26
26
  def save
27
- n_cmds = Setting[:histsize] > self.size ? self.size : Setting[:histsize]
27
+ n_cmds = Setting[:histsize] > size ? size : Setting[:histsize]
28
28
 
29
29
  open(Setting[:histfile], 'w') do |file|
30
30
  n_cmds.times { file.puts(pop) }
@@ -37,7 +37,7 @@ module Byebug
37
37
  # Discards history.
38
38
  #
39
39
  def clear
40
- self.size.times { pop }
40
+ size.times { pop }
41
41
  end
42
42
 
43
43
  #
@@ -65,7 +65,7 @@ module Byebug
65
65
  commands = Readline::HISTORY.to_a.last(show_size)
66
66
 
67
67
  (self.size - show_size + 1..self.size).to_a.zip(commands).map do |l|
68
- format("%5d %s", l[0], l[1])
68
+ format('%5d %s', l[0], l[1])
69
69
  end.join("\n") + "\n"
70
70
  end
71
71
 
@@ -26,7 +26,7 @@ module Byebug
26
26
  puts('^C')
27
27
  retry
28
28
  ensure
29
- save_history(line) unless !hist
29
+ save_history(line) if hist
30
30
  end
31
31
  end
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module Byebug
2
- VERSION = '3.5.0'
2
+ VERSION = '3.5.1'
3
3
  end
@@ -74,9 +74,12 @@ module Byebug
74
74
  end
75
75
 
76
76
  def test_shows_error_if_breakpoint_id_is_incorrect
77
- enter 'break 7', 'cond 8 b == 3', 'cont'
77
+ enter 'break 7', 'cond 2 b == 3'
78
78
 
79
- debug_proc(@example) { assert_equal 7, state.line }
79
+ debug_proc(@example)
80
+ check_error_includes \
81
+ 'Invalid breakpoint id. ' \
82
+ 'Use "info breakpoint" to find out the correct id'
80
83
  end
81
84
  end
82
85
  end
@@ -24,17 +24,15 @@ module Byebug
24
24
  end
25
25
 
26
26
  def test_restarts_with_manual_arguments
27
- force_set_const(Byebug, 'BYEBUG_SCRIPT', 'byebug_script')
28
- cmd = "#{BYEBUG_SCRIPT} #{Byebug.debugged_program} 1 2 3"
27
+ cmd = "ruby -rbyebug -I#{$LOAD_PATH.join(' -I')} test/test_helper.rb 1 2"
29
28
  must_restart(cmd)
30
29
 
31
- enter 'restart 1 2 3'
30
+ enter 'restart 1 2'
32
31
  debug_proc(@example)
33
32
  check_output_includes "Re exec'ing:\n\t#{cmd}"
34
- force_unset_const(Byebug, 'BYEBUG_SCRIPT')
35
33
  end
36
34
 
37
- def test_still_restarts_when_byebug_attached_to_running_program
35
+ def test_still_restarts_shows_messages_when_attached_to_running_program
38
36
  must_restart
39
37
  enter 'restart'
40
38
 
@@ -20,10 +20,10 @@ module Byebug
20
20
  def read_command(*)
21
21
  return readline(true) unless @input_queue.empty?
22
22
 
23
- if test_block
24
- test_block.call
25
- self.test_block = nil
26
- end
23
+ return unless test_block
24
+
25
+ test_block.call
26
+ self.test_block = nil
27
27
  end
28
28
 
29
29
  def puts(*args)
@@ -52,7 +52,7 @@ module Byebug
52
52
  def readline(hist)
53
53
  cmd = @input_queue.shift
54
54
  cmd = cmd.is_a?(Proc) ? cmd.call : cmd
55
- save_history(cmd) unless !hist
55
+ save_history(cmd) if hist
56
56
  cmd
57
57
  end
58
58
  end
@@ -82,6 +82,18 @@ module Byebug
82
82
  end
83
83
  end
84
84
 
85
+ #
86
+ # Set default settings for testing
87
+ #
88
+ def set_defaults
89
+ Byebug::Setting.load
90
+
91
+ Byebug::Setting[:autolist] = false
92
+ Byebug::Setting[:autosave] = false
93
+ Byebug::Setting[:testing] = true
94
+ Byebug::Setting[:width] = 80
95
+ end
96
+
85
97
  def interface
86
98
  Byebug.handler.interface
87
99
  end
@@ -95,12 +107,8 @@ module Byebug
95
107
  end
96
108
 
97
109
  def force_set_const(klass, const, value)
98
- force_unset_const(klass, const)
99
- klass.const_set(const, value)
100
- end
101
-
102
- def force_unset_const(klass, const)
103
110
  klass.send(:remove_const, const) if klass.const_defined?(const)
111
+ klass.const_set(const, value)
104
112
  end
105
113
 
106
114
  def change_line_in_file(file, line, new_line_content)
@@ -26,11 +26,7 @@ module Byebug
26
26
  Byebug.breakpoints.clear if Byebug.breakpoints
27
27
  Byebug.catchpoints.clear if Byebug.catchpoints
28
28
 
29
- Byebug::Setting.load
30
- Byebug::Setting[:autolist] = false
31
- Byebug::Setting[:autosave] = false
32
- Byebug::Setting[:testing] = true
33
- Byebug::Setting[:width] = 80
29
+ set_defaults
34
30
 
35
31
  # Include test files as ignored files
36
32
  glob_exp = File.expand_path('../../{lib,test/support}/**/*.rb', __FILE__)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: byebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodriguez
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-09-28 00:00:00.000000000 Z
13
+ date: 2014-09-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: columnize