byebug 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,10 @@ module Byebug
11
11
 
12
12
  self.handler = CommandProcessor.new
13
13
 
14
+ # List of files byebug will ignore while debugging
15
+ IGNORED_FILES = Dir[Pathname.new(__FILE__) + "../**/*.rb"].map {
16
+ |f| File.expand_path(f) }
17
+
14
18
  # Default options to Byebug.start
15
19
  DEFAULT_START_SETTINGS = {
16
20
  init: true, # Set $0 and save ARGV?
@@ -133,7 +133,6 @@ module Byebug
133
133
  raise "No such setting #{name}" unless map.has_key?(name)
134
134
  map[name][:getter].call
135
135
  end
136
- c = class << @settings; self end
137
136
  c.send(:define_method, :[]=) do |name, value|
138
137
  raise "No such setting #{name}" unless map.has_key?(name)
139
138
  map[name][:setter].call(value)
@@ -193,7 +192,7 @@ module Byebug
193
192
 
194
193
  def debug_eval(str, b = get_binding)
195
194
  begin
196
- val = eval(str, b)
195
+ eval(str, b)
197
196
  rescue StandardError, ScriptError => e
198
197
  if Command.settings[:stack_trace_on_error]
199
198
  at = eval("caller(1)", b)
@@ -204,13 +203,12 @@ module Byebug
204
203
  else
205
204
  print "#{e.class} Exception: #{e.message}\n"
206
205
  end
207
- throw :debug_error
208
206
  end
209
207
  end
210
208
 
211
- def debug_silent_eval(str)
209
+ def debug_silent_eval(str, b = get_binding)
212
210
  begin
213
- eval(str, get_binding)
211
+ eval(str, b)
214
212
  rescue StandardError, ScriptError
215
213
  nil
216
214
  end
@@ -218,8 +216,8 @@ module Byebug
218
216
 
219
217
  def debug_warning_eval(str, b = get_binding)
220
218
  begin
221
- debug_eval(str, b)
222
- rescue :debug_error => e
219
+ eval(str, b)
220
+ rescue StandardError, ScriptError => e
223
221
  print "#{e.class} Exception: #{e.message}\n"
224
222
  end
225
223
  end
@@ -116,7 +116,7 @@ module Byebug
116
116
  Command.settings[:testing] = set_on
117
117
  Command.settings[:basename] = set_on
118
118
  when /^forcestep$/
119
- self.class.settings[:force_stepping] = set_on
119
+ Command.settings[:force_stepping] = set_on
120
120
  when /^history$/
121
121
  if 2 == args.size
122
122
  interface = @state.interface
@@ -77,7 +77,7 @@ module Byebug
77
77
  on_off = Command.settings[:testing]
78
78
  return "Currently testing byebug is #{show_onoff(on_off)}."
79
79
  when /^forcestep$/
80
- on_off = self.class.settings[:force_stepping]
80
+ on_off = Command.settings[:force_stepping]
81
81
  return "force-stepping is #{show_onoff(on_off)}."
82
82
  when /^fullpath$/
83
83
  on_off = Command.settings[:frame_fullpath]
@@ -36,7 +36,8 @@ module Byebug
36
36
  end
37
37
 
38
38
  def at_breakpoint(breakpoint)
39
- handler.at_breakpoint(self, breakpoint)
39
+ handler.at_breakpoint(self, breakpoint) unless
40
+ IGNORED_FILES.include?(breakpoint.source)
40
41
  end
41
42
 
42
43
  def at_catchpoint(excpt)
@@ -44,18 +45,12 @@ module Byebug
44
45
  end
45
46
 
46
47
  def at_tracing(file, line)
47
- handler.at_tracing(self, file, line)
48
+ handler.at_tracing(self, file, line) unless IGNORED_FILES.include?(file)
48
49
  end
49
50
 
50
51
  def at_line(file, line)
51
- handler.at_line(self, file, line) unless
52
- defined?(Byebug::BYEBUG_SCRIPT) and
53
- File.identical?(file, Byebug::BYEBUG_SCRIPT)
52
+ handler.at_line(self, file, line) unless IGNORED_FILES.include?(file)
54
53
  end
55
54
 
56
- #def at_return(file, line)
57
- # handler.at_return(self, file, line)
58
- #end
59
-
60
55
  end
61
56
  end
@@ -141,11 +141,9 @@ module Byebug
141
141
  protect :at_catchpoint
142
142
 
143
143
  def at_tracing(context, file, line)
144
- # Don't trace ourselves
145
- return if defined?(Byebug::BYEBUG_SCRIPT) && Byebug::BYEBUG_SCRIPT == file
146
-
147
144
  tracing_plus = Command.settings[:tracing_plus]
148
- if file != @last_file || line != @last_line || tracing_plus == false
145
+ if file != @last_file || line != @last_line ||
146
+ Command.settings[:tracing_plus] == false
149
147
  @last_file = file
150
148
  @last_line = line
151
149
  print "Tracing: #{CommandProcessor.canonic_file(file)}:#{line} " \
@@ -1,3 +1,3 @@
1
1
  module Byebug
2
- VERSION = '1.3.1'
2
+ VERSION = '1.4.0'
3
3
  end
@@ -135,8 +135,6 @@ class TestDisplay < TestDsl::TestCase
135
135
  end
136
136
 
137
137
  describe 'Post Mortem' do
138
- temporary_change_hash Byebug::Command.settings, :autoeval, false
139
-
140
138
  it 'must be able to set display expressions in post-mortem mode' do
141
139
  enter 'cont', 'display 2 + 2'
142
140
  debug_file 'post_mortem'
@@ -20,4 +20,4 @@ byebug
20
20
  20
21
21
  21
22
22
  22
23
- a = '%23'
23
+ a = '%23'
@@ -2,10 +2,6 @@ require_relative 'test_helper'
2
2
 
3
3
  class TestFrame < TestDsl::TestCase
4
4
 
5
- # XXX: Calculate magic number dinamically, like
6
- # "longest_string_in_test_output".size
7
- temporary_change_hash Byebug::Command.settings, :width, 96
8
-
9
5
  it 'must go up' do
10
6
  enter 'break 16', 'cont', 'up'
11
7
  debug_file('frame') { state.line.must_equal 12 }
@@ -38,8 +34,8 @@ class TestFrame < TestDsl::TestCase
38
34
 
39
35
  it 'must print current stack frame when without arguments' do
40
36
  enter 'break A.d', 'cont', 'up', 'frame'
41
- debug_file('frame') {
42
- check_output_includes "#0 A.d(e#String) at #{fullpath('frame')}:15" }
37
+ debug_file('frame')
38
+ check_output_includes /#0 A.d(e#String) at #{fullpath('frame')}:15/x
43
39
  end
44
40
 
45
41
  it 'must set frame to the first one' do
@@ -82,8 +78,8 @@ class TestFrame < TestDsl::TestCase
82
78
  enter 'break 16', 'cont', 'where'
83
79
  debug_file 'frame'
84
80
  check_output_includes \
85
- "--> #0 A.d(e#String) at #{fullpath('frame')}:16",
86
- " #1 A.c at #{fullpath('frame')}:12"
81
+ /--> #0 A.d(e#String) at #{fullpath('frame')}:16/x,
82
+ /#1 A.c at #{fullpath('frame')}:12/x
87
83
  end
88
84
  end
89
85
 
@@ -94,8 +90,8 @@ class TestFrame < TestDsl::TestCase
94
90
  enter 'set nofullpath', 'break 16', 'cont', 'where'
95
91
  debug_file 'frame'
96
92
  check_output_includes \
97
- "--> #0 A.d(e#String) at #{short_path(fullpath('frame'))}:16",
98
- " #1 A.c at #{short_path(fullpath('frame'))}:12"
93
+ /--> #0 A.d(e#String) at #{short_path(fullpath('frame'))}:16/x,
94
+ /#1 A.c at #{short_path(fullpath('frame'))}:12/x
99
95
  end
100
96
  end
101
97
  end
@@ -108,10 +104,10 @@ class TestFrame < TestDsl::TestCase
108
104
  enter 'break 16', 'cont', 'where'
109
105
  debug_file 'frame'
110
106
  check_output_includes \
111
- "--> #0 A.d(e#String) at #{fullpath('frame')}:16",
112
- " #1 A.c at #{fullpath('frame')}:12" ,
113
- " #2 A.b at #{fullpath('frame')}:8" ,
114
- " #3 A.a at #{fullpath('frame')}:5"
107
+ /--> #0 A.d(e#String) at #{fullpath('frame')}:16/x,
108
+ /#1 A.c at #{fullpath('frame')}:12/x ,
109
+ /#2 A.b at #{fullpath('frame')}:8/x ,
110
+ /#3 A.a at #{fullpath('frame')}:5/x
115
111
  end
116
112
  end
117
113
 
@@ -121,10 +117,10 @@ class TestFrame < TestDsl::TestCase
121
117
  it 'displays current backtrace with callstyle "short"' do
122
118
  enter 'break 16', 'cont', 'where'
123
119
  debug_file 'frame'
124
- check_output_includes "--> #0 d(e) at #{fullpath('frame')}:16",
125
- " #1 c at #{fullpath('frame')}:12" ,
126
- " #2 b at #{fullpath('frame')}:8" ,
127
- " #3 a at #{fullpath('frame')}:5"
120
+ check_output_includes /--> #0 d(e) at #{fullpath('frame')}:16/x,
121
+ /#1 c at #{fullpath('frame')}:12/x,
122
+ /#2 b at #{fullpath('frame')}:8/x,
123
+ /#3 a at #{fullpath('frame')}:5/x
128
124
  end
129
125
  end
130
126
 
@@ -230,16 +230,12 @@ class TestInfo < TestDsl::TestCase
230
230
  end
231
231
 
232
232
  describe 'Stack info' do
233
- # XXX: Calculate magic number dinamically, like
234
- # "longest_string_in_test_output".size
235
- temporary_change_hash Byebug::Command.settings, :width, 87
236
-
237
233
  it 'must show stack info' do
238
234
  enter 'set fullpath', 'break 20', 'cont', 'info stack'
239
235
  debug_file 'info'
240
- check_output_includes "--> #0 A.a at #{fullpath('info')}:20",
241
- " #1 A.b at #{fullpath('info')}:30",
242
- " #2 <main> at #{fullpath('info')}:36"
236
+ check_output_includes /--> #0 A.a at #{fullpath('info')}:20/x,
237
+ /#1 A.b at #{fullpath('info')}:30/x,
238
+ /#2 <main> at #{fullpath('info')}:36/x
243
239
  end
244
240
  end
245
241
 
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: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodríguez
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-02 00:00:00.000000000 Z
13
+ date: 2013-06-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: columnize
@@ -88,20 +88,21 @@ dependencies:
88
88
  requirements:
89
89
  - - ~>
90
90
  - !ruby/object:Gem::Version
91
- version: 5.0.2
91
+ version: 5.0.3
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ~>
97
97
  - !ruby/object:Gem::Version
98
- version: 5.0.2
98
+ version: 5.0.3
99
99
  description: |-
100
100
  Byebug is a Ruby 2.0 debugger. It's implemented using the
101
- Ruby 2.0 TracePoint C API. The C extension was forked from debase whereas
102
- the rest of the gem was forked from debugger. The core component provides
103
- support that front-ends can build on. It provides breakpoint handling,
104
- bindings for stack frames among other things.
101
+ Ruby 2.0 TracePoint C API for execution control and the Debug Inspector C
102
+ API for call stack navigation. The core component provides support that
103
+ front-ends can build on. It provides breakpoint handling and bindings for
104
+ stack frames among other things and it comes with an easy to use command
105
+ line interface.
105
106
  email: deivid.rodriguez@mail.com
106
107
  executables:
107
108
  - byebug