ruby-debug-ide 0.6.1 → 0.7.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58463736d53be1eaadb08e9afbd21a2c1243f951
4
- data.tar.gz: 35f18cafbee8ec4aab79592e4283aee5c602b00d
3
+ metadata.gz: 2d69d1cfb5b86870712e0c746ead1254dc1f82e3
4
+ data.tar.gz: d7f642ffb2759051727072897298cf058faab95f
5
5
  SHA512:
6
- metadata.gz: 8d8901f0c3476e91f6d861682464afc064cd647d1e3aa86bd409097f3e518e99e3644199c6b4f8d9e96eaec24ad185c33cc366b39fd6a40360a68dafa357c68c
7
- data.tar.gz: 4d2a747833b7286fb5f918325f7baede0187ef62dd0ff6f6f92dfa0504722ebc304bed9fd44fbf0590698d043f03bd5e28e1acbb431e679c9109d70c0562d620
6
+ metadata.gz: 3e822e846ace7dc9926dea1d5ce49f50cf0f5ae748613b498d2de077639938cbe9c6420aa3c61eb9759462404274f9ca9e119a825b72df1ac6ccbd3d7ee8bf6c
7
+ data.tar.gz: 57c33149c8ac6ca7649f11b1c0a146f1fb93fd5ea3918ea66ca916e330178183cbe830af89b1f90211c386a55d2ef4c8ce1eedad2f29b606cd13ed102489af26
@@ -131,6 +131,14 @@ else
131
131
  Debugger::PROG_SCRIPT = $0
132
132
  end
133
133
 
134
+ if RUBY_VERSION < "1.9"
135
+ lib_path = File.expand_path(File.dirname(__FILE__) + "/../lib/")
136
+ $: << lib_path unless $:.include? lib_path
137
+ require 'ruby-debug-ide/thread_alias.rb'
138
+ else
139
+ require_relative '../lib/ruby-debug-ide/thread_alias'
140
+ end
141
+
134
142
  if options.dispatcher_port != -1
135
143
  ENV['IDE_PROCESS_DISPATCHER'] = options.dispatcher_port.to_s
136
144
  if RUBY_VERSION < "1.9"
@@ -18,6 +18,13 @@ require 'ruby-debug-ide/event_processor'
18
18
  module Debugger
19
19
 
20
20
  class << self
21
+ def find_free_port(host)
22
+ server = TCPServer.open(host, 0)
23
+ port = server.addr[1]
24
+ server.close
25
+ port
26
+ end
27
+
21
28
  # Prints to the stderr using printf(*args) if debug logging flag (-d) is on.
22
29
  def print_debug(*args)
23
30
  if Debugger.cli_debug
@@ -111,9 +118,15 @@ module Debugger
111
118
  # 127.0.0.1 seemingly works with all systems and with IPv6 as well.
112
119
  # "localhost" and nil have problems on some systems.
113
120
  host ||= '127.0.0.1'
114
- server = TCPServer.new(host, port)
115
- print_greeting_msg($stderr, host, port) if defined? IDE_VERSION
116
- notify_dispatcher(port) if notify_dispatcher
121
+
122
+ server = notify_dispatcher_if_needed(host, port, notify_dispatcher) do |real_port, port_changed = false|
123
+ s = TCPServer.new(host, real_port)
124
+ print_greeting_msg $stderr, host, real_port, port_changed ? "Subprocess" : "Fast" if defined? IDE_VERSION
125
+ s
126
+ end
127
+
128
+ return unless server
129
+
117
130
  while (session = server.accept)
118
131
  $stderr.puts "Connected from #{session.peeraddr[2]}" if Debugger.cli_debug
119
132
  dispatcher = ENV['IDE_PROCESS_DISPATCHER']
@@ -141,8 +154,9 @@ module Debugger
141
154
 
142
155
  private
143
156
 
157
+ def notify_dispatcher_if_needed(host, port, need_notify)
158
+ return yield port unless need_notify
144
159
 
145
- def notify_dispatcher(port)
146
160
  return unless ENV['IDE_PROCESS_DISPATCHER']
147
161
  acceptor_host, acceptor_port = ENV['IDE_PROCESS_DISPATCHER'].split(":")
148
162
  acceptor_host, acceptor_port = '127.0.0.1', acceptor_host unless acceptor_port
@@ -151,11 +165,19 @@ module Debugger
151
165
  3.times do |i|
152
166
  begin
153
167
  s = TCPSocket.open(acceptor_host, acceptor_port)
168
+ dispatcher_answer = s.gets.chomp
169
+
170
+ if dispatcher_answer == "true"
171
+ port = Debugger.find_free_port(host)
172
+ end
173
+
174
+ server = yield port, dispatcher_answer == "true"
175
+
154
176
  s.print(port)
155
177
  s.close
156
178
  connected = true
157
179
  print_debug "Ide process dispatcher notified about sub-debugger which listens on #{port}\n"
158
- return
180
+ return server
159
181
  rescue => bt
160
182
  $stderr.puts "#{Process.pid}: connection failed(#{i+1})"
161
183
  $stderr.puts "Exception: #{bt}"
@@ -164,7 +186,6 @@ module Debugger
164
186
  end unless connected
165
187
  end
166
188
  end
167
-
168
189
  end
169
190
 
170
191
  class Exception # :nodoc:
@@ -128,9 +128,18 @@ module Debugger
128
128
  to_inspect = Command.unescape_incoming(str)
129
129
  max_time = Debugger.evaluation_timeout
130
130
  @printer.print_debug("Evaluating %s with timeout after %i sec", str, max_time)
131
+
132
+ Debugger::TimeoutHandler.do_thread_alias
133
+
134
+ eval_result = nil
135
+
131
136
  timeout(max_time) do
132
- eval(to_inspect, b)
137
+ eval_result = eval(to_inspect, b)
133
138
  end
139
+
140
+ Debugger::TimeoutHandler.undo_thread_alias
141
+
142
+ return eval_result
134
143
  rescue StandardError, ScriptError => e
135
144
  @printer.print_exception(e, @state.binding)
136
145
  throw :debug_error
@@ -10,7 +10,7 @@ require 'ruby-debug-ide/ide_processor'
10
10
  module Debugger
11
11
 
12
12
  class << self
13
- def print_greeting_msg(stream, host, port)
13
+ def print_greeting_msg(stream, host, port, debugger_name = "Fast")
14
14
  base_gem_name = if defined?(JRUBY_VERSION) || RUBY_VERSION < '1.9.0'
15
15
  'ruby-debug-base'
16
16
  elsif RUBY_VERSION < '2.0.0'
@@ -31,7 +31,7 @@ module Debugger
31
31
  listens_on = "\n"
32
32
  end
33
33
 
34
- msg = "Fast Debugger (ruby-debug-ide #{IDE_VERSION}, #{base_gem_name} #{VERSION}, file filtering is #{file_filtering_support})" + listens_on
34
+ msg = "#{debugger_name} Debugger (ruby-debug-ide #{IDE_VERSION}, #{base_gem_name} #{VERSION}, file filtering is #{file_filtering_support})" + listens_on
35
35
 
36
36
  stream.printf msg
37
37
  end
@@ -11,7 +11,7 @@ module Debugger
11
11
  'frame_bind' => false,
12
12
  'host' => host,
13
13
  'load_mode' => false,
14
- 'port' => find_free_port(host),
14
+ 'port' => Debugger.find_free_port(host),
15
15
  'stop' => false,
16
16
  'tracing' => false,
17
17
  'int_handler' => true,
@@ -24,7 +24,7 @@ module Debugger
24
24
  )
25
25
 
26
26
  if(options.ignore_port)
27
- options.port = find_free_port(options.host)
27
+ options.port = Debugger.find_free_port(options.host)
28
28
  options.notify_dispatcher = true
29
29
  end
30
30
 
@@ -54,14 +54,6 @@ module Debugger
54
54
  Debugger.cli_debug = options.cli_debug
55
55
  Debugger.prepare_debugger(options)
56
56
  end
57
-
58
-
59
- def find_free_port(host)
60
- server = TCPServer.open(host, 0)
61
- port = server.addr[1]
62
- server.close
63
- port
64
- end
65
57
  end
66
58
  end
67
59
  end
@@ -0,0 +1,2 @@
1
+ OldThread = Thread
2
+ Thread = Debugger::DebugThread
@@ -0,0 +1 @@
1
+ Thread = OldThread
@@ -0,0 +1,13 @@
1
+ module Debugger
2
+ module TimeoutHandler
3
+ class << self
4
+ def do_thread_alias
5
+ load File.expand_path(File.dirname(__FILE__) + '/thread-alias/alias_thread.rb')
6
+ end
7
+
8
+ def undo_thread_alias
9
+ load File.expand_path(File.dirname(__FILE__) + '/thread-alias/unalias_thread.rb')
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Debugger
2
- IDE_VERSION='0.6.1'
2
+ IDE_VERSION='0.7.0.beta2'
3
3
  end
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.6.1
4
+ version: 0.7.0.beta2
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: 2018-02-01 00:00:00.000000000 Z
11
+ date: 2018-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -80,6 +80,9 @@ files:
80
80
  - lib/ruby-debug-ide/multiprocess/pre_child.rb
81
81
  - lib/ruby-debug-ide/multiprocess/starter.rb
82
82
  - lib/ruby-debug-ide/multiprocess/unmonkey.rb
83
+ - lib/ruby-debug-ide/thread-alias/alias_thread.rb
84
+ - lib/ruby-debug-ide/thread-alias/unalias_thread.rb
85
+ - lib/ruby-debug-ide/thread_alias.rb
83
86
  - lib/ruby-debug-ide/version.rb
84
87
  - lib/ruby-debug-ide/xml_printer.rb
85
88
  - ruby-debug-ide.gemspec
@@ -98,9 +101,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
101
  version: 1.8.2
99
102
  required_rubygems_version: !ruby/object:Gem::Requirement
100
103
  requirements:
101
- - - ">="
104
+ - - ">"
102
105
  - !ruby/object:Gem::Version
103
- version: '0'
106
+ version: 1.3.1
104
107
  requirements: []
105
108
  rubyforge_project: debug-commons
106
109
  rubygems_version: 2.6.10