ruby-debug-ide 0.4.22 → 0.4.23.beta1

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YjhlMmUxYjViODBlZTIxM2UzNDdlMGI3YjNjNTQ1NjQwNzAwNDA4NA==
5
+ data.tar.gz: !binary |-
6
+ NTFkYjI5OTgzNjhkMzFhZjMyZTJmYzdmOTg0NTYxZGU2ZGZiNzc2Nw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NGNiMGRhMWM1NjhmYTU1ZTQ0YTUxOWRjNzk5NjM4Mzg0Mzc4YmQyY2VkOTlj
10
+ NTM5YzFmOGU1MTllOTM1MjQ1NWE5NTk1MDM5MzVhMjY5Njg2NzA2NGQ0NjRl
11
+ MjZjOTA1ZjExNDQ0YWRlMzcyNTQzYzZkYjc0NTJmNDZhYjU2NjA=
12
+ data.tar.gz: !binary |-
13
+ MzVmNjk5NzcwNDU4NWJkMTFmOWEwZjE0MDU1NGVhNDZmNWUwYzdlZDcwMmRk
14
+ NTE0MTQ3ZDg3ODI5ODk5NTQxYWFlYjlkM2Q5M2MzOWM3ZDAzNTE3YTY2OGQ2
15
+ NWMxMmEzMWYyYzBlNGEwYmMyNzQ1MDE5YzVlNTMzNDMwNzMxZDc=
@@ -1,11 +1,12 @@
1
1
  jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
2
+ rbx = defined?(RUBY_ENGINE) && 'rbx' == RUBY_ENGINE
2
3
 
3
4
  def already_installed(dep)
4
5
  !Gem::DependencyInstaller.new(:domain => :local).find_gems_with_sources(dep).empty? ||
5
6
  !Gem::DependencyInstaller.new(:domain => :local,:prerelease => true).find_gems_with_sources(dep).empty?
6
7
  end
7
8
 
8
- unless jruby
9
+ unless jruby || rbx
9
10
  require 'rubygems'
10
11
  require 'rubygems/command.rb'
11
12
  require 'rubygems/dependency.rb'
@@ -2,7 +2,7 @@ require 'pp'
2
2
  require 'stringio'
3
3
  require "socket"
4
4
  require 'thread'
5
- if (RUBY_VERSION < '2.0' || defined?(JRUBY_VERSION))
5
+ if RUBY_VERSION < '2.0' || defined?(JRUBY_VERSION)
6
6
  require 'ruby-debug-base'
7
7
  else
8
8
  require 'debase'
@@ -59,20 +59,20 @@ module Debugger
59
59
  end
60
60
  end
61
61
 
62
- def start_server(host = nil, port = 1234)
62
+ def start_server(host = nil, port = 1234, notify_dispatcher = false)
63
63
  return if started?
64
64
  start
65
- start_control(host, port)
65
+ start_control(host, port, notify_dispatcher)
66
66
  end
67
67
 
68
68
  def prepare_debugger(options)
69
- start_server(options.host, options.port)
70
-
71
- raise "Control thread did not start (#{@control_thread}}" unless @control_thread && @control_thread.alive?
72
-
73
69
  @mutex = Mutex.new
74
70
  @proceed = ConditionVariable.new
75
71
 
72
+ start_server(options.host, options.port, options.notify_dispatcher)
73
+
74
+ raise "Control thread did not start (#{@control_thread}}" unless @control_thread && @control_thread.alive?
75
+
76
76
  # wait for 'start' command
77
77
  @mutex.synchronize do
78
78
  @proceed.wait(@mutex)
@@ -97,7 +97,7 @@ module Debugger
97
97
  end
98
98
  end
99
99
 
100
- def start_control(host, port)
100
+ def start_control(host, port, notify_dispatcher)
101
101
  raise "Debugger is not started" unless started?
102
102
  return if @control_thread
103
103
  @control_thread = DebugThread.new do
@@ -105,10 +105,12 @@ module Debugger
105
105
  # 127.0.0.1 seemingly works with all systems and with IPv6 as well.
106
106
  # "localhost" and nil have problems on some systems.
107
107
  host ||= '127.0.0.1'
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
108
  server = TCPServer.new(host, port)
109
+ gem_name = (defined?(JRUBY_VERSION) || RUBY_VERSION < '1.9.0') ? 'ruby-debug-base' :
110
+ RUBY_VERSION < '2.0.0' ? 'ruby-debug-base19x' : 'debase'
111
111
  $stderr.printf "Fast Debugger (ruby-debug-ide #{IDE_VERSION}, #{gem_name} #{VERSION}) listens on #{host}:#{port}\n"
112
+ notify_dispatcher(port) if notify_dispatcher
113
+
112
114
  while (session = server.accept)
113
115
  $stderr.puts "Connected from #{session.peeraddr[2]}" if Debugger.cli_debug
114
116
  dispatcher = ENV['IDE_PROCESS_DISPATCHER']
@@ -122,7 +124,7 @@ module Debugger
122
124
  IdeControlCommandProcessor.new(interface).process_commands
123
125
  rescue StandardError, ScriptError => ex
124
126
  bt = ex.backtrace
125
- $stderr.printf "#{Process.pid}: Exception in DebugThread loop: #{ex.message}\nBacktrace:\n#{bt ? bt.join("\n from: ") : "<none>"}\n"
127
+ $stderr.printf "#{Process.pid}: Exception in DebugThread loop: #{ex.message}(#{ex.class})\nBacktrace:\n#{bt ? bt.join("\n from: ") : "<none>"}\n"
126
128
  exit 1
127
129
  end
128
130
  end
@@ -134,6 +136,31 @@ module Debugger
134
136
  end
135
137
  end
136
138
 
139
+ private
140
+
141
+ def notify_dispatcher(port)
142
+ return unless ENV['IDE_PROCESS_DISPATCHER']
143
+ acceptor_host, acceptor_port = ENV['IDE_PROCESS_DISPATCHER'].split(":")
144
+ acceptor_host, acceptor_port = '127.0.0.1', acceptor_host unless acceptor_port
145
+
146
+ connected = false
147
+ 3.times do |i|
148
+ begin
149
+ s = TCPSocket.open(acceptor_host, acceptor_port)
150
+ s.print(port)
151
+ s.close
152
+ connected = true
153
+ print_debug "Ide process dispatcher notified about sub-debugger which listens on #{port}\n"
154
+ return
155
+ rescue => bt
156
+ $stderr.puts "#{Process.pid}: connection failed(#{i+1})"
157
+ $stderr.puts "Exception: #{bt}"
158
+ $stderr.puts bt.backtrace.map { |l| "\t#{l}" }.join("\n")
159
+ sleep 0.3
160
+ end unless connected
161
+ end
162
+ end
163
+
137
164
  end
138
165
 
139
166
  class Exception # :nodoc:
@@ -59,6 +59,9 @@ module Debugger
59
59
  end
60
60
 
61
61
  class VarInstanceCommand < Command # :nodoc:
62
+ # TODO: try to find out a way to use Kernel.binding
63
+ BINDING_COMMAND = (defined? Rubinius) ? 'binding' : '::Kernel.binding'
64
+
62
65
  def regexp
63
66
  # id will be read as first match, name as post match
64
67
  /^\s*v(?:ar)?\s+i(?:nstance)?\s+((?:[\\+-]0x)[\dabcdef]+)?/
@@ -67,8 +70,9 @@ module Debugger
67
70
  def execute
68
71
  if (@match[1])
69
72
  obj = ObjectSpace._id2ref(@match[1].hex) rescue nil
73
+
70
74
  unless obj
71
- # TODO: ensure that empty variables frame will be printed
75
+ print_element("variables")
72
76
  @printer.print_msg("Unknown object id : %s", @match[1])
73
77
  end
74
78
  else
@@ -86,7 +90,7 @@ module Debugger
86
90
  # instance variables
87
91
  kind = 'instance'
88
92
  inst_vars = obj.instance_variables
89
- instance_binding = obj.instance_eval{::Kernel.binding()}
93
+ instance_binding = obj.instance_eval(BINDING_COMMAND)
90
94
  # print self at top position
91
95
  print_variable('self', debug_eval('self', instance_binding), kind) if inst_vars.include?('self')
92
96
  inst_vars.sort.each do |var|
@@ -94,7 +98,7 @@ module Debugger
94
98
  end
95
99
 
96
100
  # class variables
97
- class_binding = obj.class.class_eval('::Kernel.binding()')
101
+ class_binding = obj.class.class_eval(BINDING_COMMAND)
98
102
  obj.class.class_variables.sort.each do |var|
99
103
  print_variable(var, debug_eval(var, class_binding), 'class')
100
104
  end
@@ -47,7 +47,7 @@ module Debugger
47
47
  end
48
48
  state.restore_context
49
49
  end
50
- rescue IOError, Errno::EPIPE
50
+ rescue IOError, SystemCallError
51
51
  @printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
52
52
  @printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
53
53
  rescue Exception
@@ -93,10 +93,12 @@ module Debugger
93
93
  end
94
94
  end
95
95
  end
96
- rescue IOError, Errno::EPIPE
96
+ rescue IOError, SystemCallError
97
+ @printer.print_debug "INTERNAL ERROR!!! #{$!}\n"
97
98
  @printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
98
99
  @printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
99
100
  rescue Exception
101
+ @printer.print_debug "INTERNAL ERROR!!! #{$!}\n" rescue nil
100
102
  @printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
101
103
  @printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
102
104
  ensure
@@ -1,19 +1,6 @@
1
1
  require 'thread'
2
2
 
3
- class TCPSocket
4
-
5
- # Workaround for JRuby issue http://jira.codehaus.org/browse/JRUBY-2063
6
- def non_blocking_gets
7
- loop do
8
- result, _, _ = IO.select( [self], nil, nil, 0.2 )
9
- next unless result
10
- return result[0].gets
11
- end
12
- end
13
-
14
- end
15
-
16
- module Debugger
3
+ module Debugger
17
4
  class Interface
18
5
  end
19
6
 
@@ -23,7 +10,6 @@ module Debugger
23
10
 
24
11
  class RemoteInterface < Interface # :nodoc:
25
12
  attr_accessor :command_queue
26
- attr_accessor :socket
27
13
 
28
14
  def initialize(socket)
29
15
  @socket = socket
@@ -31,7 +17,7 @@ module Debugger
31
17
  end
32
18
 
33
19
  def read_command
34
- result = @socket.non_blocking_gets
20
+ result = non_blocking_gets
35
21
  raise IOError unless result
36
22
  result.chomp
37
23
  end
@@ -42,9 +28,18 @@ module Debugger
42
28
 
43
29
  def close
44
30
  @socket.close
45
- rescue Exception
31
+ rescue IOError
46
32
  end
47
-
33
+
34
+ # Workaround for JRuby issue http://jira.codehaus.org/browse/JRUBY-2063
35
+ def non_blocking_gets
36
+ loop do
37
+ result, _, _ = IO.select( [@socket], nil, nil, 0.2 )
38
+ next unless result
39
+ return result[0].gets
40
+ end
41
+ end
42
+
48
43
  end
49
44
 
50
45
  end
@@ -17,28 +17,11 @@ module Debugger
17
17
  'stop' => false,
18
18
  'tracing' => false,
19
19
  'int_handler' => true,
20
- 'cli_debug' => (ENV['DEBUGGER_CLI_DEBUG'] == 'true')
20
+ 'cli_debug' => (ENV['DEBUGGER_CLI_DEBUG'] == 'true'),
21
+ 'notify_dispatcher' => true
21
22
  )
22
23
 
23
- acceptor_host, acceptor_port = ENV['IDE_PROCESS_DISPATCHER'].split(":")
24
- acceptor_host, acceptor_port = '127.0.0.1', acceptor_host unless acceptor_port
25
-
26
- connected = false
27
- 3.times do |i|
28
- begin
29
- s = TCPSocket.open(acceptor_host, acceptor_port)
30
- s.print(port)
31
- s.close
32
- connected = true
33
- start_debugger(options)
34
- return
35
- rescue => bt
36
- $stderr.puts "#{Process.pid}: connection failed(#{i+1})"
37
- $stderr.puts "Exception: #{bt}"
38
- $stderr.puts bt.backtrace.map { |l| "\t#{l}" }.join("\n")
39
- sleep 0.3
40
- end unless connected
41
- end
24
+ start_debugger(options)
42
25
  end
43
26
 
44
27
  def start_debugger(options)
@@ -46,7 +29,7 @@ module Debugger
46
29
  # we're in forked child, only need to restart control thread
47
30
  Debugger.breakpoints.clear
48
31
  Debugger.control_thread = nil
49
- Debugger.start_control(options.host, options.port)
32
+ Debugger.start_control(options.host, options.port, options.notify_dispatcher)
50
33
  end
51
34
 
52
35
  if options.int_handler
@@ -1,3 +1,3 @@
1
1
  module Debugger
2
- IDE_VERSION='0.4.22'
2
+ IDE_VERSION='0.4.23.beta1'
3
3
  end
@@ -130,8 +130,12 @@ module Debugger
130
130
 
131
131
  def print_string(string)
132
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')
133
+ if string.respond_to?('bytes')
134
+ bytes = string.bytes.to_a
135
+ InspectCommand.reference_result(bytes)
136
+ print_variable('bytes', bytes, 'instance')
137
+ end
138
+ print_variable('encoding', string.encoding, 'instance') if string.respond_to?('encoding')
135
139
  end
136
140
  end
137
141
 
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-debug-ide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.22
5
- prerelease:
4
+ version: 0.4.23.beta1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Markus Barchfeld, Martin Krauskopf, Mark Moseley, JetBrains RubyMine Team
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-18 00:00:00.000000000 Z
11
+ date: 2014-03-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -41,12 +38,12 @@ files:
41
38
  - CHANGES
42
39
  - ChangeLog
43
40
  - ChangeLog.archive
41
+ - Gemfile
44
42
  - MIT-LICENSE
45
43
  - Rakefile
46
- - ext/mkrf_conf.rb
47
- - Gemfile
48
- - ruby-debug-ide.gemspec
49
44
  - bin/rdebug-ide
45
+ - ext/mkrf_conf.rb
46
+ - lib/ruby-debug-ide.rb
50
47
  - lib/ruby-debug-ide/command.rb
51
48
  - lib/ruby-debug-ide/commands/breakpoints.rb
52
49
  - lib/ruby-debug-ide/commands/catchpoint.rb
@@ -67,35 +64,34 @@ files:
67
64
  - lib/ruby-debug-ide/helper.rb
68
65
  - lib/ruby-debug-ide/ide_processor.rb
69
66
  - lib/ruby-debug-ide/interface.rb
67
+ - lib/ruby-debug-ide/multiprocess.rb
70
68
  - lib/ruby-debug-ide/multiprocess/monkey.rb
71
69
  - lib/ruby-debug-ide/multiprocess/pre_child.rb
72
70
  - lib/ruby-debug-ide/multiprocess/starter.rb
73
- - lib/ruby-debug-ide/multiprocess.rb
74
71
  - lib/ruby-debug-ide/version.rb
75
72
  - lib/ruby-debug-ide/xml_printer.rb
76
- - lib/ruby-debug-ide.rb
73
+ - ruby-debug-ide.gemspec
77
74
  homepage: https://github.com/ruby-debug/ruby-debug-ide
78
75
  licenses: []
76
+ metadata: {}
79
77
  post_install_message:
80
78
  rdoc_options: []
81
79
  require_paths:
82
80
  - lib
83
81
  required_ruby_version: !ruby/object:Gem::Requirement
84
- none: false
85
82
  requirements:
86
83
  - - ! '>='
87
84
  - !ruby/object:Gem::Version
88
85
  version: 1.8.2
89
86
  required_rubygems_version: !ruby/object:Gem::Requirement
90
- none: false
91
87
  requirements:
92
- - - ! '>='
88
+ - - ! '>'
93
89
  - !ruby/object:Gem::Version
94
- version: '0'
90
+ version: 1.3.1
95
91
  requirements: []
96
92
  rubyforge_project: debug-commons
97
- rubygems_version: 1.8.25
93
+ rubygems_version: 2.2.2
98
94
  signing_key:
99
- specification_version: 3
95
+ specification_version: 4
100
96
  summary: IDE interface for ruby-debug.
101
97
  test_files: []