debugger 1.5.0 → 1.6.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.
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/README.md +2 -6
- data/debugger.gemspec +1 -1
- data/lib/debugger/test/test_interface.rb +4 -13
- data/lib/debugger/version.rb +1 -1
- data/lib/ruby-debug.rb +1 -1
- data/lib/ruby-debug/command.rb +1 -1
- data/lib/ruby-debug/commands/eval.rb +16 -13
- data/lib/ruby-debug/commands/info.rb +14 -17
- data/lib/ruby-debug/commands/list.rb +3 -0
- data/lib/ruby-debug/commands/skip.rb +1 -1
- data/lib/ruby-debug/commands/variables.rb +1 -1
- data/lib/ruby-debug/printers/plain.rb +1 -1
- data/lib/ruby-debug/processor.rb +1 -2
- data/test/eval_test.rb +8 -4
- data/test/list_test.rb +8 -4
- metadata +5 -5
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 1.6.0
|
2
|
+
* Make autoeval and autolist true the default
|
3
|
+
* Bump ruby_core_source dependency
|
4
|
+
* Fix printf bugs
|
5
|
+
* Fix printer require issues
|
6
|
+
* Fix some warnings
|
7
|
+
|
1
8
|
## 1.5.0
|
2
9
|
* Add support for any output adapters e.g. xml
|
3
10
|
* Bump debugger-linecache dependency
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -43,12 +43,6 @@ from two locations:
|
|
43
43
|
* ~/.rdebugrc (~/rdebug.ini for windows)
|
44
44
|
* $PWD/.rdebugrc ($PWD/rdebug.ini for windows)
|
45
45
|
|
46
|
-
Here's a common configuration (yeah, I should make this the default):
|
47
|
-
|
48
|
-
set autolist
|
49
|
-
set autoeval
|
50
|
-
set autoreload
|
51
|
-
|
52
46
|
To see debugger's current settings, use the `set` command.
|
53
47
|
|
54
48
|
### Using Commands
|
@@ -98,6 +92,7 @@ tutorial](http://bashdb.sourceforge.net/ruby-debug/rdebug-emacs.html)
|
|
98
92
|
* See changelog for more
|
99
93
|
* Minor
|
100
94
|
* The gem name matches the module namespace, Debugger, and main required file, debugger.
|
95
|
+
* autolist and autoeval enabled by default
|
101
96
|
* ruby-debug-base19 and ruby-debug19 are released as one gem
|
102
97
|
* Rake tasks have been updated
|
103
98
|
* No more $LOAD_PATH manipulation or runtime code outside of lib
|
@@ -123,6 +118,7 @@ Let's keep this working for the ruby community!
|
|
123
118
|
debugger commands and more
|
124
119
|
* [debugger-xml](https://github.com/astashov/debugger-xml) - XML interface for debugger, compatible
|
125
120
|
with ruby-debug-ide
|
121
|
+
* [vim-ruby-debugger] - Vim plugin that uses debugger
|
126
122
|
* [debugger-pry](https://github.com/pry/debugger-pry) - using pry within debugger
|
127
123
|
* [pry-debugger](https://github.com/nixme/pry-debugger) - using debugger within pry
|
128
124
|
* [ruby-debug-passenger](https://github.com/davejamesmiller/ruby-debug-passenger) - rake task to
|
data/debugger.gemspec
CHANGED
@@ -20,7 +20,7 @@ handling, bindings for stack frames among other things.
|
|
20
20
|
s.extensions << "ext/ruby_debug/extconf.rb"
|
21
21
|
s.executables = ["rdebug"]
|
22
22
|
s.add_dependency "columnize", ">= 0.3.1"
|
23
|
-
s.add_dependency "debugger-ruby_core_source", '~> 1.2.
|
23
|
+
s.add_dependency "debugger-ruby_core_source", '~> 1.2.1'
|
24
24
|
s.add_dependency "debugger-linecache", '~> 1.2.0'
|
25
25
|
s.add_development_dependency 'rake', '~> 0.9.2.2'
|
26
26
|
s.add_development_dependency 'rake-compiler', '~> 0.8.0'
|
@@ -12,8 +12,8 @@ class TestInterface < Debugger::Interface
|
|
12
12
|
@readline_support = false
|
13
13
|
end
|
14
14
|
|
15
|
-
def errmsg(
|
16
|
-
@error_queue <<
|
15
|
+
def errmsg(value)
|
16
|
+
@error_queue << value
|
17
17
|
end
|
18
18
|
|
19
19
|
def read_command(*args)
|
@@ -25,8 +25,8 @@ class TestInterface < Debugger::Interface
|
|
25
25
|
result.is_a?(Proc) ? result.call : result
|
26
26
|
end
|
27
27
|
|
28
|
-
def print(
|
29
|
-
@output_queue <<
|
28
|
+
def print(value)
|
29
|
+
@output_queue << value
|
30
30
|
end
|
31
31
|
|
32
32
|
def confirm(message)
|
@@ -58,13 +58,4 @@ class TestInterface < Debugger::Interface
|
|
58
58
|
].join("\n")
|
59
59
|
end
|
60
60
|
|
61
|
-
private
|
62
|
-
|
63
|
-
def format(args)
|
64
|
-
if args.size > 1
|
65
|
-
args.first % args[1..-1]
|
66
|
-
else
|
67
|
-
args.first
|
68
|
-
end
|
69
|
-
end
|
70
61
|
end
|
data/lib/debugger/version.rb
CHANGED
data/lib/ruby-debug.rb
CHANGED
@@ -4,7 +4,7 @@ require 'socket'
|
|
4
4
|
require 'thread'
|
5
5
|
require 'ruby-debug-base'
|
6
6
|
require 'ruby-debug/processor'
|
7
|
-
|
7
|
+
require 'ruby-debug/printers/plain'
|
8
8
|
|
9
9
|
module Debugger
|
10
10
|
self.handler = CommandProcessor.new
|
data/lib/ruby-debug/command.rb
CHANGED
@@ -181,7 +181,7 @@ module Debugger
|
|
181
181
|
# TODO: Add optional timeout
|
182
182
|
def debug_eval(str, b = get_binding)
|
183
183
|
begin
|
184
|
-
|
184
|
+
eval(str, b)
|
185
185
|
rescue StandardError, ScriptError => e
|
186
186
|
text_message = if Command.settings[:stack_trace_on_error]
|
187
187
|
at = eval("caller(1)", b)
|
@@ -21,7 +21,7 @@ module Debugger
|
|
21
21
|
$__dbg_interface = nil
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
class EvalCommand < Command # :nodoc:
|
26
26
|
register_setting_get(:autoeval) do
|
27
27
|
EvalCommand.unknown
|
@@ -30,11 +30,14 @@ module Debugger
|
|
30
30
|
EvalCommand.unknown = value
|
31
31
|
end
|
32
32
|
|
33
|
+
# Set default value
|
34
|
+
Command.settings[:autoeval] = 1
|
35
|
+
|
33
36
|
def match(input)
|
34
37
|
@input = input
|
35
38
|
super
|
36
39
|
end
|
37
|
-
|
40
|
+
|
38
41
|
def regexp
|
39
42
|
/^\s*(p|e(?:val)?)\s+/
|
40
43
|
end
|
@@ -69,7 +72,7 @@ module Debugger
|
|
69
72
|
|
70
73
|
class PPCommand < Command # :nodoc:
|
71
74
|
self.allow_in_control = true
|
72
|
-
|
75
|
+
|
73
76
|
def regexp
|
74
77
|
/^\s*pp\s+/
|
75
78
|
end
|
@@ -80,7 +83,7 @@ module Debugger
|
|
80
83
|
PP.pp(debug_eval(@match.post_match, b), out)
|
81
84
|
end
|
82
85
|
print out.string
|
83
|
-
rescue
|
86
|
+
rescue
|
84
87
|
out.puts $!.message
|
85
88
|
end
|
86
89
|
|
@@ -99,7 +102,7 @@ module Debugger
|
|
99
102
|
|
100
103
|
class PutLCommand < Command # :nodoc:
|
101
104
|
self.allow_in_control = true
|
102
|
-
|
105
|
+
|
103
106
|
def regexp
|
104
107
|
/^\s*putl\s+/
|
105
108
|
end
|
@@ -110,13 +113,13 @@ module Debugger
|
|
110
113
|
vals = debug_eval(@match.post_match, b)
|
111
114
|
if vals.is_a?(Array)
|
112
115
|
vals = vals.map{|item| item.to_s}
|
113
|
-
print "
|
116
|
+
print "#{columnize(vals, self.class.settings[:width])}\n"
|
114
117
|
else
|
115
118
|
PP.pp(vals, out)
|
116
119
|
print out.string
|
117
120
|
end
|
118
121
|
end
|
119
|
-
rescue
|
122
|
+
rescue
|
120
123
|
out.puts $!.message
|
121
124
|
end
|
122
125
|
|
@@ -132,12 +135,12 @@ module Debugger
|
|
132
135
|
end
|
133
136
|
end
|
134
137
|
end
|
135
|
-
|
138
|
+
|
136
139
|
class PSCommand < Command # :nodoc:
|
137
140
|
self.allow_in_control = true
|
138
|
-
|
141
|
+
|
139
142
|
include EvalFunctions
|
140
|
-
|
143
|
+
|
141
144
|
def regexp
|
142
145
|
/^\s*ps\s+/
|
143
146
|
end
|
@@ -148,13 +151,13 @@ module Debugger
|
|
148
151
|
vals = debug_eval(@match.post_match, b)
|
149
152
|
if vals.is_a?(Array)
|
150
153
|
vals = vals.map{|item| item.to_s}
|
151
|
-
print "
|
154
|
+
print "#{columnize(vals.sort!, self.class.settings[:width])}\n"
|
152
155
|
else
|
153
156
|
PP.pp(vals, out)
|
154
157
|
print out.string
|
155
158
|
end
|
156
159
|
end
|
157
|
-
rescue
|
160
|
+
rescue
|
158
161
|
out.puts $!.message
|
159
162
|
end
|
160
163
|
|
@@ -170,5 +173,5 @@ module Debugger
|
|
170
173
|
end
|
171
174
|
end
|
172
175
|
end
|
173
|
-
|
176
|
+
|
174
177
|
end
|
@@ -143,11 +143,9 @@ item. If \'verbose\' is given then the entire stack frame is shown.'],
|
|
143
143
|
print "Num Enb What\n"
|
144
144
|
brkpts.each do |b|
|
145
145
|
if b.expr.nil?
|
146
|
-
print
|
147
|
-
b.id, (b.enabled? ? 'y' : 'n'), b.source, b.pos
|
146
|
+
print("%3d %s at %s:%s\n" % [b.id, (b.enabled? ? 'y' : 'n'), b.source, b.pos])
|
148
147
|
else
|
149
|
-
print
|
150
|
-
b.id, (b.enabled? ? 'y' : 'n'), b.source, b.pos, b.expr
|
148
|
+
print("%3d %s at %s:%s if %s\n" % [b.id, (b.enabled? ? 'y' : 'n'), b.source, b.pos, b.expr])
|
151
149
|
end
|
152
150
|
hits = b.hit_count
|
153
151
|
if hits > 0
|
@@ -170,8 +168,7 @@ item. If \'verbose\' is given then the entire stack frame is shown.'],
|
|
170
168
|
print "Num Enb Expression\n"
|
171
169
|
n = 1
|
172
170
|
for d in @state.display
|
173
|
-
print
|
174
|
-
d[0] != nil
|
171
|
+
print("%3d: %s %s\n" % [n, (d[0] ? 'y' : 'n'), d[1]]) if d[0] != nil
|
175
172
|
n += 1
|
176
173
|
end
|
177
174
|
else
|
@@ -202,17 +199,17 @@ item. If \'verbose\' is given then the entire stack frame is shown.'],
|
|
202
199
|
LineCache::cache(file, Command.settings[:reload_source_on_change])
|
203
200
|
end
|
204
201
|
|
205
|
-
print
|
202
|
+
print("File #{file}")
|
206
203
|
path = LineCache.path(file)
|
207
204
|
if %w(all basic path).member?(subcmd.name) and path != file
|
208
|
-
print
|
205
|
+
print(" - #{path}\n")
|
209
206
|
else
|
210
207
|
print "\n"
|
211
208
|
end
|
212
209
|
|
213
210
|
if %w(all basic lines).member?(subcmd.name)
|
214
211
|
lines = LineCache.size(file)
|
215
|
-
print
|
212
|
+
print("\t #{lines} lines\n") if lines
|
216
213
|
end
|
217
214
|
|
218
215
|
if %w(all breakpoints).member?(subcmd.name)
|
@@ -225,10 +222,10 @@ item. If \'verbose\' is given then the entire stack frame is shown.'],
|
|
225
222
|
|
226
223
|
if %w(all mtime).member?(subcmd.name)
|
227
224
|
stat = LineCache.stat(file)
|
228
|
-
print
|
225
|
+
print("\t#{stat.mtime}\n") if stat
|
229
226
|
end
|
230
227
|
if %w(all sha1).member?(subcmd.name)
|
231
|
-
print
|
228
|
+
print("\t#{LineCache.sha1(file)}\n")
|
232
229
|
end
|
233
230
|
end
|
234
231
|
|
@@ -238,13 +235,13 @@ item. If \'verbose\' is given then the entire stack frame is shown.'],
|
|
238
235
|
files.uniq.sort.each do |file|
|
239
236
|
stat = LineCache::stat(file)
|
240
237
|
path = LineCache::path(file)
|
241
|
-
print
|
238
|
+
print("File #{file}")
|
242
239
|
if path and path != file
|
243
|
-
print " -
|
240
|
+
print " - #{path}\n"
|
244
241
|
else
|
245
242
|
print "\n"
|
246
243
|
end
|
247
|
-
print "\t
|
244
|
+
print "\t#{stat.mtime}\n" if stat
|
248
245
|
end
|
249
246
|
end
|
250
247
|
|
@@ -262,7 +259,7 @@ item. If \'verbose\' is given then the entire stack frame is shown.'],
|
|
262
259
|
errmsg "info line not available here.\n"
|
263
260
|
return
|
264
261
|
end
|
265
|
-
print "Line
|
262
|
+
print "Line #{@state.line} of \"#{@state.file}\"\n"
|
266
263
|
end
|
267
264
|
|
268
265
|
def info_locals(*args)
|
@@ -310,7 +307,7 @@ item. If \'verbose\' is given then the entire stack frame is shown.'],
|
|
310
307
|
when :catchpoint
|
311
308
|
print("It stopped at a catchpoint.\n")
|
312
309
|
else
|
313
|
-
print "unknown reason:
|
310
|
+
print "unknown reason: #{@state.context.stop_reason.to_s}\n"
|
314
311
|
end
|
315
312
|
end
|
316
313
|
|
@@ -347,7 +344,7 @@ item. If \'verbose\' is given then the entire stack frame is shown.'],
|
|
347
344
|
def info_threads(*args)
|
348
345
|
ok, verbose = info_thread_preamble(args[0])
|
349
346
|
return unless ok
|
350
|
-
|
347
|
+
Debugger.contexts.sort_by{|c| c.thnum}.each do |c|
|
351
348
|
display_context(c, !verbose)
|
352
349
|
if verbose and not c.ignored?
|
353
350
|
(0...c.stack_size).each do |idx|
|
data/lib/ruby-debug/processor.rb
CHANGED
@@ -177,8 +177,7 @@ module Debugger
|
|
177
177
|
file = CommandProcessor.canonic_file(file)
|
178
178
|
unless file == @last_file and @last_line == line and
|
179
179
|
Command.settings[:tracing_plus]
|
180
|
-
print
|
181
|
-
context.thnum, file, line, Debugger.line_at(file, line)
|
180
|
+
print("Tracing(%d):%s:%s %s" % [context.thnum, file, line, Debugger.line_at(file, line)])
|
182
181
|
@last_file = file
|
183
182
|
@last_line = line
|
184
183
|
end
|
data/test/eval_test.rb
CHANGED
@@ -22,13 +22,17 @@ describe "Eval Command" do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "autoeval" do
|
25
|
-
|
26
|
-
|
27
|
-
it "must eval the expression if no matching command is found" do
|
28
|
-
enter 'set autoeval', '[5,6,7].inject(&:+)'
|
25
|
+
it "must eval the expression if no matching command is found by default" do
|
26
|
+
enter '[5,6,7].inject(&:+)'
|
29
27
|
debug_file 'eval'
|
30
28
|
check_output_includes "18"
|
31
29
|
end
|
30
|
+
|
31
|
+
it "must not eval the expression if no matching command is found if toogled" do
|
32
|
+
enter 'set noautoeval', '[5,6,7].inject(&:+)'
|
33
|
+
debug_file 'eval'
|
34
|
+
check_output_doesnt_include "18"
|
35
|
+
end
|
32
36
|
end
|
33
37
|
|
34
38
|
describe "evaluate with error" do
|
data/test/list_test.rb
CHANGED
@@ -55,13 +55,17 @@ describe "List Command" do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
describe "autolist" do
|
58
|
-
|
59
|
-
|
60
|
-
it "must show the surronding lines even without 'list' command if autolist is enabled" do
|
61
|
-
enter 'set autolist', 'break 5', 'cont'
|
58
|
+
it "must show the surrounding lines even without 'list' command by default" do
|
59
|
+
enter 'break 5', 'cont'
|
62
60
|
debug_file 'list'
|
63
61
|
check_output_includes "[4, 6] in #{fullpath('list')}", "4 4", "=> 5 5", "6 6"
|
64
62
|
end
|
63
|
+
|
64
|
+
it "must not show the surronding lines by default when autolist is toggled" do
|
65
|
+
enter 'set noautolist', 'break 5', 'cont'
|
66
|
+
debug_file 'list'
|
67
|
+
check_output_doesnt_include "[4, 6] in #{fullpath('list')}", "4 4", "=> 5 5", "6 6"
|
68
|
+
end
|
65
69
|
end
|
66
70
|
|
67
71
|
describe "specified lines" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debugger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-05-15 00:00:00.000000000Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: columnize
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 1.2.
|
39
|
+
version: 1.2.1
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.2.
|
47
|
+
version: 1.2.1
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: debugger-linecache
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -357,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
357
357
|
version: 1.3.6
|
358
358
|
requirements: []
|
359
359
|
rubyforge_project:
|
360
|
-
rubygems_version: 1.8.
|
360
|
+
rubygems_version: 1.8.19
|
361
361
|
signing_key:
|
362
362
|
specification_version: 3
|
363
363
|
summary: Fast Ruby debugger - base + cli
|