ruby-debug-ide 0.4.23.beta1 → 0.4.23.beta7

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjhlMmUxYjViODBlZTIxM2UzNDdlMGI3YjNjNTQ1NjQwNzAwNDA4NA==
4
+ NmE2MjAzZGVmZjM4NDFkOGViZGVkNTdkM2MwNTJmYWVjNjk1ZGJmMQ==
5
5
  data.tar.gz: !binary |-
6
- NTFkYjI5OTgzNjhkMzFhZjMyZTJmYzdmOTg0NTYxZGU2ZGZiNzc2Nw==
6
+ MDBhYmY5NThlMmU0ZGM3ZTkzZTE5MjNkMGMyMzQ4ZGNhYzY5ZjU4Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGNiMGRhMWM1NjhmYTU1ZTQ0YTUxOWRjNzk5NjM4Mzg0Mzc4YmQyY2VkOTlj
10
- NTM5YzFmOGU1MTllOTM1MjQ1NWE5NTk1MDM5MzVhMjY5Njg2NzA2NGQ0NjRl
11
- MjZjOTA1ZjExNDQ0YWRlMzcyNTQzYzZkYjc0NTJmNDZhYjU2NjA=
9
+ YzVjY2VkYWQ4MzRlMTMxNGRiYmM0OGVkYzRmNzQ4MThlYmQwNWU4MzAzODI2
10
+ MmRhMTM1ODBmMWJlYTkzNTM2NWI5ODJiOWIyZTY4NGNkNjlkOGNmMjM0YmJh
11
+ OGMyYWE5NGE1MTI4MzJlNzM0MTU2NmE0NTczOWE4NDMyNmRiYjE=
12
12
  data.tar.gz: !binary |-
13
- MzVmNjk5NzcwNDU4NWJkMTFmOWEwZjE0MDU1NGVhNDZmNWUwYzdlZDcwMmRk
14
- NTE0MTQ3ZDg3ODI5ODk5NTQxYWFlYjlkM2Q5M2MzOWM3ZDAzNTE3YTY2OGQ2
15
- NWMxMmEzMWYyYzBlNGEwYmMyNzQ1MDE5YzVlNTMzNDMwNzMxZDc=
13
+ ZmU1MDY4ZTVlMjNkMzM5ZTVmNGZiZjQ4Y2Y1YmEzOGQ2M2ZmYTIxNWVkOGIw
14
+ MzkyNjY2N2U0MDVhYTMxY2RiNjQyZDA3YzhmNGE0NzU4N2RlZmIwMzM0MGFl
15
+ NzhjMzhkN2I1MzIzMGIyNTUyMjI2OTZlZTExZmRiNzMyMDFlODQ=
@@ -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 or RubyMine. The
28
- command line interface to ruby-debug is rdebug.
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
 
@@ -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.24')
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
@@ -41,7 +41,7 @@ module Debugger
41
41
  cleared
42
42
  end
43
43
 
44
- attr_accessor :cli_debug, :xml_debug
44
+ attr_accessor :cli_debug, :xml_debug, :evaluation_timeout
45
45
  attr_accessor :control_thread
46
46
  attr_reader :interface
47
47
 
@@ -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 = 10
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 = File.expand_path(file) if file.index(File::SEPARATOR) || \
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 |largest, b|
16
- largest = b.id if b.id > largest
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 |largest, b|
7
- largest = b.id if b.id > largest
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
@@ -22,4 +22,4 @@ module Debugger
22
22
  end
23
23
  end
24
24
 
25
- end
25
+ end
@@ -67,7 +67,7 @@ module Debugger
67
67
 
68
68
  Change the next line of code to be executed.
69
69
  }
70
- end
70
+ end
71
71
  end
72
72
  end
73
73
  end
@@ -27,7 +27,7 @@ module Debugger
27
27
  %{
28
28
  pause <nnn>\tpause a running thread
29
29
  }
30
- end
30
+ end
31
31
  end
32
32
  end
33
33
  end
@@ -41,7 +41,7 @@ module Debugger
41
41
 
42
42
  Change the type of <var> to <type>
43
43
  }
44
- end
44
+ end
45
45
  end
46
46
  end
47
47
  end
@@ -134,7 +134,7 @@ module Debugger
134
134
  end
135
135
 
136
136
  def restore_context
137
- context = @original_context
137
+ @context = @original_context
138
138
  end
139
139
  end
140
140
 
@@ -28,7 +28,7 @@ module Debugger
28
28
 
29
29
  def close
30
30
  @socket.close
31
- rescue IOError
31
+ rescue IOError, SystemCallError
32
32
  end
33
33
 
34
34
  # Workaround for JRuby issue http://jira.codehaus.org/browse/JRUBY-2063
@@ -1,3 +1,3 @@
1
1
  module Debugger
2
- IDE_VERSION='0.4.23.beta1'
2
+ IDE_VERSION='0.4.23.beta7'
3
3
  end
@@ -150,7 +150,8 @@ module Debugger
150
150
  unless has_children
151
151
  value_str = "Empty #{value.class}"
152
152
  else
153
- value_str = "#{value.class} (#{value.size} element(s))"
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
- print("<variable name=\"%s\" kind=\"%s\" value=\"%s\" type=\"%s\" hasChildren=\"%s\" objectId=\"%#+x\"/>",
174
- CGI.escapeHTML(name), kind, CGI.escapeHTML(value_str), value.class,
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 => e
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 then
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
- end
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.beta1
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-23 00:00:00.000000000 Z
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