ruby-debug-ide 0.4.23.beta1 → 0.4.23.beta7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/rdebug-ide +10 -4
- data/ext/mkrf_conf.rb +3 -3
- data/lib/ruby-debug-ide.rb +1 -1
- data/lib/ruby-debug-ide/command.rb +4 -11
- data/lib/ruby-debug-ide/commands/breakpoints.rb +16 -2
- data/lib/ruby-debug-ide/commands/condition.rb +2 -2
- data/lib/ruby-debug-ide/commands/enable.rb +2 -2
- data/lib/ruby-debug-ide/commands/expression_info.rb +65 -0
- data/lib/ruby-debug-ide/commands/inspect.rb +1 -1
- data/lib/ruby-debug-ide/commands/jump.rb +1 -1
- data/lib/ruby-debug-ide/commands/pause.rb +1 -1
- data/lib/ruby-debug-ide/commands/set_type.rb +1 -1
- data/lib/ruby-debug-ide/ide_processor.rb +1 -1
- data/lib/ruby-debug-ide/interface.rb +1 -1
- data/lib/ruby-debug-ide/version.rb +1 -1
- data/lib/ruby-debug-ide/xml_printer.rb +32 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmE2MjAzZGVmZjM4NDFkOGViZGVkNTdkM2MwNTJmYWVjNjk1ZGJmMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDBhYmY5NThlMmU0ZGM3ZTkzZTE5MjNkMGMyMzQ4ZGNhYzY5ZjU4Mg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzVjY2VkYWQ4MzRlMTMxNGRiYmM0OGVkYzRmNzQ4MThlYmQwNWU4MzAzODI2
|
10
|
+
MmRhMTM1ODBmMWJlYTkzNTM2NWI5ODJiOWIyZTY4NGNkNjlkOGNmMjM0YmJh
|
11
|
+
OGMyYWE5NGE1MTI4MzJlNzM0MTU2NmE0NTczOWE4NDMyNmRiYjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmU1MDY4ZTVlMjNkMzM5ZTVmNGZiZjQ4Y2Y1YmEzOGQ2M2ZmYTIxNWVkOGIw
|
14
|
+
MzkyNjY2N2U0MDVhYTMxY2RiNjQyZDA3YzhmNGE0NzU4N2RlZmIwMzM0MGFl
|
15
|
+
NzhjMzhkN2I1MzIzMGIyNTUyMjI2OTZlZTExZmRiNzMyMDFlODQ=
|
data/bin/rdebug-ide
CHANGED
@@ -18,14 +18,16 @@ options = OpenStruct.new(
|
|
18
18
|
'stop' => false,
|
19
19
|
'tracing' => false,
|
20
20
|
'int_handler' => true,
|
21
|
-
'dispatcher_port' => -1
|
21
|
+
'dispatcher_port' => -1,
|
22
|
+
'evaluation_timeout' => 10
|
22
23
|
)
|
23
24
|
|
24
25
|
opts = OptionParser.new do |opts|
|
25
26
|
opts.banner = <<EOB
|
26
27
|
Using ruby-debug-base #{Debugger::VERSION}
|
27
|
-
Usage: rdebug-ide is supposed to be called from RDT, NetBeans
|
28
|
-
command line interface to
|
28
|
+
Usage: rdebug-ide is supposed to be called from RDT, NetBeans, RubyMine, or
|
29
|
+
the IntelliJ IDEA Ruby plugin. The command line interface to
|
30
|
+
ruby-debug is rdebug.
|
29
31
|
EOB
|
30
32
|
opts.separator ""
|
31
33
|
opts.separator "Options:"
|
@@ -33,7 +35,10 @@ EOB
|
|
33
35
|
opts.on("-p", "--port PORT", Integer, "Port used for remote debugging") {|port| options.port = port}
|
34
36
|
opts.on("--dispatcher-port PORT", Integer, "Port used for multi-process debugging dispatcher") do |dp|
|
35
37
|
options.dispatcher_port = dp
|
36
|
-
end
|
38
|
+
end
|
39
|
+
opts.on('--evaluation-timeout TIMEOUT', Integer,'evaluation timeout in seconds (default: 10)') do |timeout|
|
40
|
+
options.evaluation_timeout = timeout
|
41
|
+
end
|
37
42
|
opts.on('--stop', 'stop when the script is loaded') {options.stop = true}
|
38
43
|
opts.on("-x", "--trace", "turn on line tracing") {options.tracing = true}
|
39
44
|
opts.on("-l", "--load-mode", "load mode (experimental)") {options.load_mode = true}
|
@@ -106,6 +111,7 @@ end
|
|
106
111
|
# set options
|
107
112
|
Debugger.keep_frame_binding = options.frame_bind
|
108
113
|
Debugger.tracing = options.tracing
|
114
|
+
Debugger.evaluation_timeout = options.evaluation_timeout
|
109
115
|
|
110
116
|
Debugger.debug_program(options)
|
111
117
|
|
data/ext/mkrf_conf.rb
CHANGED
@@ -20,18 +20,18 @@ unless jruby || rbx
|
|
20
20
|
if RUBY_VERSION < "1.9"
|
21
21
|
dep = Gem::Dependency.new("ruby-debug-base", '>=0.10.4')
|
22
22
|
elsif RUBY_VERSION < '2.0'
|
23
|
-
dep = Gem::Dependency.new("ruby-debug-base19x", '>=0.11.
|
23
|
+
dep = Gem::Dependency.new("ruby-debug-base19x", '>=0.11.30.pre15')
|
24
24
|
else
|
25
25
|
dep = Gem::Dependency.new("debase", '> 0')
|
26
26
|
end
|
27
27
|
|
28
28
|
begin
|
29
29
|
puts "Installing base gem"
|
30
|
-
inst = Gem::DependencyInstaller.new
|
30
|
+
inst = Gem::DependencyInstaller.new :prerelease => dep.prerelease?
|
31
31
|
inst.install dep
|
32
32
|
rescue
|
33
|
-
inst = Gem::DependencyInstaller.new(:prerelease => true)
|
34
33
|
begin
|
34
|
+
inst = Gem::DependencyInstaller.new(:prerelease => true)
|
35
35
|
inst.install dep
|
36
36
|
rescue Exception => e
|
37
37
|
puts e
|
data/lib/ruby-debug-ide.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'ruby-debug-ide/helper'
|
2
|
+
require 'delegate'
|
2
3
|
|
3
4
|
module Debugger
|
4
5
|
|
5
|
-
class Command # :nodoc:
|
6
|
+
class Command < SimpleDelegator # :nodoc:
|
6
7
|
SubcmdStruct=Struct.new(:name, :min, :short_help, :long_help) unless
|
7
8
|
defined?(SubcmdStruct)
|
8
9
|
|
@@ -67,6 +68,7 @@ module Debugger
|
|
67
68
|
|
68
69
|
def initialize(state, printer)
|
69
70
|
@state, @printer = state, printer
|
71
|
+
super @printer
|
70
72
|
end
|
71
73
|
|
72
74
|
def match(input)
|
@@ -75,15 +77,6 @@ module Debugger
|
|
75
77
|
|
76
78
|
protected
|
77
79
|
|
78
|
-
def method_missing(meth, *args, &block)
|
79
|
-
if @printer.respond_to? meth
|
80
|
-
@printer.send meth, *args, &block
|
81
|
-
else
|
82
|
-
super
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
# FIXME: use delegate?
|
87
80
|
def errmsg(*args)
|
88
81
|
@printer.print_error(*args)
|
89
82
|
end
|
@@ -115,7 +108,7 @@ module Debugger
|
|
115
108
|
def debug_eval(str, b = get_binding)
|
116
109
|
begin
|
117
110
|
str = str.to_s
|
118
|
-
max_time =
|
111
|
+
max_time = Debugger.evaluation_timeout
|
119
112
|
to_inspect = str.gsub(/\\n/, "\n")
|
120
113
|
@printer.print_debug("Evaluating #{str} with timeout after %i sec", max_time)
|
121
114
|
timeout(max_time) do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pathname' if RUBY_VERSION < '1.9'
|
2
|
+
|
1
3
|
module Debugger
|
2
4
|
class AddBreakpoint < Command # :nodoc:
|
3
5
|
self.control = true
|
@@ -35,8 +37,7 @@ module Debugger
|
|
35
37
|
end
|
36
38
|
file = klass.name if klass
|
37
39
|
else
|
38
|
-
file =
|
39
|
-
File::ALT_SEPARATOR && file.index(File::ALT_SEPARATOR)
|
40
|
+
file = realpath(file)
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
@@ -63,6 +64,19 @@ module Debugger
|
|
63
64
|
}
|
64
65
|
end
|
65
66
|
end
|
67
|
+
|
68
|
+
private
|
69
|
+
def realpath(filename)
|
70
|
+
filename = File.expand_path(filename) if filename.index(File::SEPARATOR) || \
|
71
|
+
File::ALT_SEPARATOR && filename.index(File::ALT_SEPARATOR)
|
72
|
+
if defined?(JRUBY_VERSION)
|
73
|
+
java.io.File.new(filename).canonical_path
|
74
|
+
elsif RUBY_VERSION < '1.9'
|
75
|
+
filename
|
76
|
+
else
|
77
|
+
File.realpath(filename)
|
78
|
+
end
|
79
|
+
end
|
66
80
|
end
|
67
81
|
|
68
82
|
class BreakpointsCommand < Command # :nodoc:
|
@@ -12,8 +12,8 @@ module Debugger
|
|
12
12
|
errmsg "\"condition\" must be followed a breakpoint number and expression\n"
|
13
13
|
else
|
14
14
|
breakpoints = Debugger.breakpoints.sort_by{|b| b.id }
|
15
|
-
largest = breakpoints.inject(0) do |
|
16
|
-
|
15
|
+
largest = breakpoints.inject(0) do |largest_so_far, b|
|
16
|
+
b.id if b.id > largest_so_far
|
17
17
|
end
|
18
18
|
if 0 == largest
|
19
19
|
print "No breakpoints have been set.\n"
|
@@ -3,8 +3,8 @@ module Debugger
|
|
3
3
|
module EnableDisableFunctions # :nodoc:
|
4
4
|
def enable_disable_breakpoints(is_enable, args)
|
5
5
|
breakpoints = Debugger.breakpoints.sort_by{|b| b.id }
|
6
|
-
largest = breakpoints.inject(0) do |
|
7
|
-
|
6
|
+
largest = breakpoints.inject(0) do |largest_so_far, b|
|
7
|
+
b.id if b.id > largest_so_far
|
8
8
|
end
|
9
9
|
if 0 == largest
|
10
10
|
errmsg "No breakpoints have been set.\n"
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
require 'irb/ruby-lex'
|
3
|
+
|
4
|
+
module Debugger
|
5
|
+
|
6
|
+
class ExpressionInfoCommand < Command
|
7
|
+
def regexp
|
8
|
+
/^\s*ex(?:pression_info)?\s+/
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
string_to_parse = @match.post_match.gsub("\\n", "\n") + "\n\n\n"
|
13
|
+
total_lines = string_to_parse.count("\n") + 1
|
14
|
+
|
15
|
+
lexer = RubyLex.new
|
16
|
+
io = StringIO.new(string_to_parse)
|
17
|
+
# for passing to the lexer
|
18
|
+
io.instance_exec(string_to_parse.encoding) do |string_encoding|
|
19
|
+
@my_encoding = string_encoding
|
20
|
+
def self.encoding
|
21
|
+
@my_encoding
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
lexer.set_input(io)
|
26
|
+
|
27
|
+
last_statement = ''
|
28
|
+
last_prompt = ''
|
29
|
+
last_indent = 0
|
30
|
+
lexer.set_prompt do |ltype, indent, continue, lineno|
|
31
|
+
next if (lineno >= total_lines)
|
32
|
+
|
33
|
+
last_prompt = ltype || ''
|
34
|
+
last_indent = indent
|
35
|
+
end
|
36
|
+
|
37
|
+
lexer.each_top_level_statement do |line, line_no|
|
38
|
+
last_statement = line
|
39
|
+
end
|
40
|
+
|
41
|
+
incomplete = true
|
42
|
+
if /\A\s*\Z/m =~ last_statement[0]
|
43
|
+
incomplete = false
|
44
|
+
end
|
45
|
+
|
46
|
+
@printer.print_expression_info(incomplete, last_prompt, last_indent)
|
47
|
+
end
|
48
|
+
|
49
|
+
class << self
|
50
|
+
def help_command
|
51
|
+
"expression_info"
|
52
|
+
end
|
53
|
+
|
54
|
+
def help(cmd)
|
55
|
+
%{
|
56
|
+
ex[pression_info] <expression>\t
|
57
|
+
returns parser-related information for the expression given\t\t
|
58
|
+
'incomplete'=true|false\tindicates whether expression is a complete ruby
|
59
|
+
expression and can be evaluated without getting syntax errors
|
60
|
+
}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -150,7 +150,8 @@ module Debugger
|
|
150
150
|
unless has_children
|
151
151
|
value_str = "Empty #{value.class}"
|
152
152
|
else
|
153
|
-
|
153
|
+
size = value.size
|
154
|
+
value_str = "#{value.class} (#{value.size} element#{size > 1 ? "s" : "" })"
|
154
155
|
end
|
155
156
|
elsif value.is_a?(String)
|
156
157
|
has_children = value.respond_to?('bytes') || value.respond_to?('encoding')
|
@@ -170,9 +171,29 @@ module Debugger
|
|
170
171
|
end
|
171
172
|
end
|
172
173
|
value_str = "[Binary Data]" if (value_str.respond_to?('is_binary_data?') && value_str.is_binary_data?)
|
173
|
-
|
174
|
-
|
174
|
+
compact_value_str = build_compact_name(value_str, value)
|
175
|
+
print("<variable name=\"%s\" compactValue=\"%s\" kind=\"%s\" value=\"%s\" type=\"%s\" hasChildren=\"%s\" objectId=\"%#+x\">",
|
176
|
+
CGI.escapeHTML(name), CGI.escapeHTML(compact_value_str), kind, CGI.escapeHTML(value_str), value.class,
|
175
177
|
has_children, value.respond_to?(:object_id) ? value.object_id : value.id)
|
178
|
+
print("<value><![CDATA[%s]]></value>", CGI.escapeHTML(value_str))
|
179
|
+
print('</variable>')
|
180
|
+
end
|
181
|
+
|
182
|
+
def build_compact_name(value_str, value)
|
183
|
+
compact = value_str
|
184
|
+
if value.is_a?(Array)
|
185
|
+
slice = value[0..10]
|
186
|
+
compact = slice.inspect
|
187
|
+
if (value.size != slice.size)
|
188
|
+
compact = compact[0..compact.size-2] + ", ...]"
|
189
|
+
end
|
190
|
+
end
|
191
|
+
if value.is_a?(Hash)
|
192
|
+
slice = value.sort_by { |k,v| k }[0..5]
|
193
|
+
compact = slice.map {|kv| "#{kv[0]}: #{kv[1]}"}.join(", ")
|
194
|
+
compact = "{" + compact + (slice.size != value.size ? ", ..." : "") + "}"
|
195
|
+
end
|
196
|
+
compact
|
176
197
|
end
|
177
198
|
|
178
199
|
def print_breakpoints(breakpoints)
|
@@ -218,6 +239,11 @@ module Debugger
|
|
218
239
|
def print_expression(exp, value, idx)
|
219
240
|
print "<dispay name=\"%s\" value=\"%s\" no=\"%d\" />", exp, value, idx
|
220
241
|
end
|
242
|
+
|
243
|
+
def print_expression_info(incomplete, prompt, indent)
|
244
|
+
print "<expressionInfo incomplete=\"%s\" prompt=\"%s\" indent=\"%s\"></expressionInfo>",
|
245
|
+
incomplete, CGI.escapeHTML(prompt), indent
|
246
|
+
end
|
221
247
|
|
222
248
|
def print_eval(exp, value)
|
223
249
|
print "<eval expression=\"%s\" value=\"%s\" />", CGI.escapeHTML(exp), value
|
@@ -282,7 +308,7 @@ module Debugger
|
|
282
308
|
InspectCommand.reference_result(proxy)
|
283
309
|
print_variable('error', proxy, 'exception')
|
284
310
|
end
|
285
|
-
rescue Exception
|
311
|
+
rescue Exception
|
286
312
|
print "<processingException type=\"%s\" message=\"%s\"/>",
|
287
313
|
exception.class, CGI.escapeHTML(exception.to_s)
|
288
314
|
end
|
@@ -294,11 +320,11 @@ module Debugger
|
|
294
320
|
end
|
295
321
|
|
296
322
|
def print_load_result(file, exception=nil)
|
297
|
-
if exception
|
323
|
+
if exception
|
298
324
|
print("<loadResult file=\"%s\" exceptionType=\"%s\" exceptionMessage=\"%s\"/>", file, exception.class, CGI.escapeHTML(exception.to_s))
|
299
325
|
else
|
300
326
|
print("<loadResult file=\"%s\" status=\"OK\"/>", file)
|
301
|
-
|
327
|
+
end
|
302
328
|
end
|
303
329
|
|
304
330
|
def print_element(name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-debug-ide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.23.
|
4
|
+
version: 0.4.23.beta7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Barchfeld, Martin Krauskopf, Mark Moseley, JetBrains RubyMine Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03
|
11
|
+
date: 2014-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/ruby-debug-ide/commands/control.rb
|
52
52
|
- lib/ruby-debug-ide/commands/enable.rb
|
53
53
|
- lib/ruby-debug-ide/commands/eval.rb
|
54
|
+
- lib/ruby-debug-ide/commands/expression_info.rb
|
54
55
|
- lib/ruby-debug-ide/commands/frame.rb
|
55
56
|
- lib/ruby-debug-ide/commands/inspect.rb
|
56
57
|
- lib/ruby-debug-ide/commands/jump.rb
|