ruby-debug-ide 0.4.17.beta14 → 0.4.17.beta16

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/Gemfile CHANGED
@@ -6,7 +6,7 @@ gem "ruby-debug-base19x", ">= 0.11.30.pre4", :platforms => [:ruby_19, :mingw_19]
6
6
  gemspec
7
7
 
8
8
  group :development do
9
- gem "bundler", "~> 1.0.0"
9
+ gem "bundler"
10
10
  end
11
11
 
12
12
  group :test do
@@ -1,13 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # start by patching require, so command-line debug won't get in the way
3
- ::Kernel.module_eval do
4
- alias ide_debug_original_require require
5
- def self.require(file)
6
- ide_debug_original_require(file) if file !~ /ruby-debug(.rb)?$/
7
- end
8
- private :require
9
- end
10
-
11
2
  require 'rubygems'
12
3
  require 'optparse'
13
4
  require "ostruct"
@@ -18,8 +18,10 @@ unless jruby
18
18
 
19
19
  if RUBY_VERSION < "1.9"
20
20
  dep = Gem::Dependency.new("ruby-debug-base", '>=0.10.4')
21
- else
21
+ elsif RUBY_VERSION < '2.0'
22
22
  dep = Gem::Dependency.new("ruby-debug-base19x", '>=0.11.24')
23
+ else
24
+ # dep = Gem::Dependency.new("debase", '> 0')
23
25
  end
24
26
 
25
27
  begin
@@ -35,7 +37,7 @@ unless jruby
35
37
  puts e.backtrace.join "\n "
36
38
  exit(1)
37
39
  end
38
- end unless already_installed(dep)
40
+ end unless dep.nil? || already_installed(dep)
39
41
  end
40
42
 
41
43
  # create dummy rakefile to indicate success
@@ -2,7 +2,11 @@ require 'pp'
2
2
  require 'stringio'
3
3
  require "socket"
4
4
  require 'thread'
5
- require 'ruby-debug-base'
5
+ if (RUBY_VERSION < '2.0')
6
+ require 'ruby-debug-base'
7
+ else
8
+ require 'debase'
9
+ end
6
10
 
7
11
  require 'ruby-debug-ide/version'
8
12
  require 'ruby-debug-ide/xml_printer'
@@ -36,56 +40,11 @@ module Debugger
36
40
  end
37
41
  cleared
38
42
  end
39
- end
40
-
41
- class Context
42
- def interrupt
43
- self.stop_next = 1
44
- end
45
-
46
- private
47
-
48
- def event_processor
49
- Debugger.event_processor
50
- end
51
-
52
- def at_breakpoint(breakpoint)
53
- event_processor.at_breakpoint(self, breakpoint)
54
- end
55
-
56
- def at_catchpoint(excpt)
57
- event_processor.at_catchpoint(self, excpt)
58
- end
59
-
60
- def at_tracing(file, line)
61
- if event_processor
62
- event_processor.at_tracing(self, file, line)
63
- else
64
- Debugger::print_debug "trace: location=\"%s:%s\", threadId=%d", file, line, self.thnum
65
- end
66
- end
67
-
68
- def at_line(file, line)
69
- event_processor.at_line(self, file, line)
70
- end
71
-
72
- def at_return(file, line)
73
- event_processor.at_return(self, file, line)
74
- end
75
- end
76
-
77
- class << self
78
43
 
79
- attr_accessor :event_processor, :cli_debug, :xml_debug
44
+ attr_accessor :cli_debug, :xml_debug
80
45
  attr_accessor :control_thread
81
46
  attr_reader :interface
82
-
83
- #
84
- # Interrupts the current thread
85
- #
86
- def interrupt
87
- current_context.interrupt
88
- end
47
+
89
48
 
90
49
  #
91
50
  # Interrupts the last debugged thread
@@ -146,7 +105,9 @@ module Debugger
146
105
  # 127.0.0.1 seemingly works with all systems and with IPv6 as well.
147
106
  # "localhost" and nil have problems on some systems.
148
107
  host ||= '127.0.0.1'
149
- $stderr.printf "Fast Debugger (ruby-debug-ide #{IDE_VERSION}, ruby-debug-base #{VERSION}) listens on #{host}:#{port}\n"
108
+ gem_name = (defined?(JRUBY_VERSION) || RUBY_VERSION < '1.9.0') ? 'ruby-debug-base' :
109
+ RUBY_VERSION < '2.0.0' ? 'ruby-debug-base19x' : 'debase'
110
+ $stderr.printf "Fast Debugger (ruby-debug-ide #{IDE_VERSION}, #{gem_name} #{VERSION}) listens on #{host}:#{port}\n"
150
111
  server = TCPServer.new(host, port)
151
112
  while (session = server.accept)
152
113
  $stderr.puts "Connected from #{session.addr[2]}" if Debugger.cli_debug
@@ -156,7 +117,7 @@ module Debugger
156
117
  end
157
118
  begin
158
119
  @interface = RemoteInterface.new(session)
159
- @event_processor = EventProcessor.new(interface)
120
+ self.handler = EventProcessor.new(interface)
160
121
  IdeControlCommandProcessor.new(interface).process_commands
161
122
  rescue StandardError, ScriptError => ex
162
123
  bt = ex.backtrace
@@ -177,21 +138,4 @@ module Debugger
177
138
  class Exception # :nodoc:
178
139
  attr_reader :__debug_file, :__debug_line, :__debug_binding, :__debug_context
179
140
  end
180
-
181
- module Kernel
182
- #
183
- # Stops the current thread after a number of _steps_ made.
184
- #
185
- def debugger(steps = 1)
186
- Debugger.current_context.stop_next = steps
187
- end
188
-
189
- #
190
- # Returns a binding of n-th call frame
191
- #
192
- def binding_n(n = 0)
193
- Debugger.current_context.frame_binding[n+1]
194
- end
195
- end
196
-
197
141
  end
@@ -79,6 +79,8 @@ module Debugger
79
79
  print_array(obj)
80
80
  elsif (obj.is_a?(Hash)) then
81
81
  print_hash(obj)
82
+ elsif (obj.is_a?(String))
83
+ print_string(obj)
82
84
  else
83
85
  print_element("variables") do
84
86
  # instance variables
@@ -13,13 +13,13 @@ module Debugger
13
13
  end
14
14
 
15
15
  def process_commands
16
- unless Debugger.event_processor.at_line?
16
+ unless Debugger.handler.at_line?
17
17
  @printer.print_error "There is no thread suspended at the time and therefore no context to execute '#{input.gsub('%', '%%')}'"
18
18
  return
19
19
  end
20
- context = Debugger.event_processor.context
21
- file = Debugger.event_processor.file
22
- line = Debugger.event_processor.line
20
+ context = Debugger.handler.context
21
+ file = Debugger.handler.file
22
+ line = Debugger.handler.line
23
23
  state = State.new do |s|
24
24
  s.context = context
25
25
  s.file = file
@@ -1,3 +1,3 @@
1
1
  module Debugger
2
- IDE_VERSION='0.4.17.beta14'
2
+ IDE_VERSION='0.4.17.beta16'
3
3
  end
@@ -127,6 +127,13 @@ module Debugger
127
127
  }
128
128
  end
129
129
  end
130
+
131
+ def print_string(string)
132
+ print_element("variables") do
133
+ print_variable('bytes', string.bytes.to_a, 'instance') if string.respond_to?('bytes')
134
+ print_variable('encoding', string.encoding, 'instance') if string.respond_to?('encoding')
135
+ end
136
+ end
130
137
 
131
138
  def print_variable(name, value, kind)
132
139
  name = name.to_s
@@ -141,13 +148,20 @@ module Debugger
141
148
  else
142
149
  value_str = "#{value.class} (#{value.size} element(s))"
143
150
  end
144
- else
151
+ elsif value.is_a?(String)
152
+ has_children = value.respond_to?('bytes') || value.respond_to?('encoding')
153
+ value_str = value
154
+ else
145
155
  has_children = !value.instance_variables.empty? || !value.class.class_variables.empty?
146
156
  value_str = value.to_s || 'nil' rescue "<#to_s method raised exception: #$!>"
147
157
  unless value_str.is_a?(String)
148
158
  value_str = "ERROR: #{value.class}.to_s method returns #{value_str.class}. Should return String."
149
159
  end
150
160
  end
161
+
162
+ if value_str.respond_to?('encode')
163
+ value_str = value_str.encode("UTF-8")
164
+ end
151
165
  value_str = "[Binary Data]" if (value_str.respond_to?('is_binary_data?') && value_str.is_binary_data?)
152
166
  print("<variable name=\"%s\" kind=\"%s\" value=\"%s\" type=\"%s\" hasChildren=\"%s\" objectId=\"%#+x\"/>",
153
167
  CGI.escapeHTML(name), kind, CGI.escapeHTML(value_str), value.class,
@@ -256,12 +270,12 @@ module Debugger
256
270
  end
257
271
 
258
272
  def print_exception(exception, binding)
259
- print_variables(%w(error), 'exception') do |var|
273
+ print_element("variables") do
260
274
  proxy = ExceptionProxy.new(exception)
261
275
  InspectCommand.reference_result(proxy)
262
- proxy
276
+ print_variable('error', proxy, 'exception')
263
277
  end
264
- rescue
278
+ rescue Exception => e
265
279
  print "<processingException type=\"%s\" message=\"%s\"/>",
266
280
  exception.class, CGI.escapeHTML(exception.to_s)
267
281
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-debug-ide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.17.beta14
4
+ version: 0.4.17.beta16
5
5
  prerelease: 7
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-25 00:00:00.000000000 Z
12
+ date: 2013-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake