ruby-debug-ide 0.6.1.beta8 → 0.6.1.beta9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rdebug-ide +27 -22
- data/lib/ruby-debug-ide.rb +13 -13
- data/lib/ruby-debug-ide/version.rb +1 -1
- data/lib/ruby-debug-ide/xml_printer.rb +63 -27
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2852711026ba805b67c3c434639bafe781c94fb
|
4
|
+
data.tar.gz: 67501296e2f294e1c9cb3295cef40004d628593f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 164dea0a96937cd8cfa702141ff3320e7c4b85469d9c26212774a8865ba21253d7560ec448ab6bb5da0d34fe760811b5a8447a0fb25ac4ce37b255a480aff473
|
7
|
+
data.tar.gz: 42999728cea96ed4e609acc8c51e3e37f2f3d3db96e7790c36c886da4260219e52eb7611aa658f2015c973859f19ba90bf4ac693943860da67cf1617ab6fb5b1
|
data/bin/rdebug-ide
CHANGED
@@ -11,20 +11,20 @@ end
|
|
11
11
|
$stdout.sync=true
|
12
12
|
|
13
13
|
options = OpenStruct.new(
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
14
|
+
'frame_bind' => false,
|
15
|
+
'host' => nil,
|
16
|
+
'load_mode' => false,
|
17
|
+
'port' => 1234,
|
18
|
+
'stop' => false,
|
19
|
+
'tracing' => false,
|
20
|
+
'int_handler' => true,
|
21
|
+
'dispatcher_port' => -1,
|
22
|
+
'evaluation_timeout' => 10,
|
23
|
+
'rm_protocol_extensions' => false,
|
24
|
+
'catchpoint_deleted_event' => false,
|
25
|
+
'value_as_nested_element' => false,
|
26
|
+
'attach_mode' => false,
|
27
|
+
'cli_debug' => false
|
28
28
|
)
|
29
29
|
|
30
30
|
opts = OptionParser.new do |opts|
|
@@ -36,20 +36,25 @@ Usage: rdebug-ide is supposed to be called from RDT, NetBeans, RubyMine, or
|
|
36
36
|
EOB
|
37
37
|
opts.separator ""
|
38
38
|
opts.separator "Options:"
|
39
|
-
|
39
|
+
|
40
|
+
Debugger.trace_to_s = false
|
41
|
+
opts.on("--evaluation-control", "trace to_s evaluation") do
|
42
|
+
Debugger.trace_to_s = true
|
43
|
+
end
|
44
|
+
|
40
45
|
ENV['DEBUGGER_MEMORY_LIMIT'] = '10'
|
41
|
-
opts.on("-m", "--memory-limit LIMIT", Integer, "evaluation memory limit in mb (default: 10)") do |limit|
|
42
|
-
ENV['DEBUGGER_MEMORY_LIMIT'] = limit
|
46
|
+
opts.on("-m", "--memory-limit LIMIT", Integer, "evaluation memory limit in mb (default: 10)") do |limit|
|
47
|
+
ENV['DEBUGGER_MEMORY_LIMIT'] = limit.to_s
|
43
48
|
end
|
44
|
-
|
49
|
+
|
45
50
|
ENV['INSPECT_TIME_LIMIT'] = '100'
|
46
|
-
opts.on("-t", "--time-limit LIMIT", Integer, "evaluation time limit in milliseconds (default: 100)") do |limit|
|
47
|
-
ENV['INSPECT_TIME_LIMIT'] = limit
|
51
|
+
opts.on("-t", "--time-limit LIMIT", Integer, "evaluation time limit in milliseconds (default: 100)") do |limit|
|
52
|
+
ENV['INSPECT_TIME_LIMIT'] = limit.to_s
|
48
53
|
end
|
49
54
|
|
50
55
|
opts.on("-h", "--host HOST", "Host name used for remote debugging") {|host| options.host = host}
|
51
56
|
opts.on("-p", "--port PORT", Integer, "Port used for remote debugging") {|port| options.port = port}
|
52
|
-
opts.on("--dispatcher-port PORT", Integer, "Port used for multi-process debugging dispatcher") do |dp|
|
57
|
+
opts.on("--dispatcher-port PORT", Integer, "Port used for multi-process debugging dispatcher") do |dp|
|
53
58
|
options.dispatcher_port = dp
|
54
59
|
end
|
55
60
|
opts.on('--evaluation-timeout TIMEOUT', Integer,'evaluation timeout in seconds (default: 10)') do |timeout|
|
@@ -133,7 +138,7 @@ if options.dispatcher_port != -1
|
|
133
138
|
end
|
134
139
|
Debugger::MultiProcess.do_monkey
|
135
140
|
|
136
|
-
ENV['DEBUGGER_STORED_RUBYLIB'] = ENV['RUBYLIB']
|
141
|
+
ENV['DEBUGGER_STORED_RUBYLIB'] = ENV['RUBYLIB']
|
137
142
|
old_opts = ENV['RUBYOPT'] || ''
|
138
143
|
starter = "-r#{File.expand_path(File.dirname(__FILE__))}/../lib/ruby-debug-ide/multiprocess/starter"
|
139
144
|
unless old_opts.include? starter
|
data/lib/ruby-debug-ide.rb
CHANGED
@@ -29,22 +29,22 @@ module Debugger
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def cleanup_backtrace(backtrace)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
32
|
+
cleared = []
|
33
|
+
return cleared unless backtrace
|
34
|
+
backtrace.each do |line|
|
35
|
+
if line.index(File.expand_path(File.dirname(__FILE__) + "/..")) == 0
|
36
|
+
next
|
37
|
+
end
|
38
|
+
if line.index("-e:1") == 0
|
39
|
+
break
|
40
|
+
end
|
41
|
+
cleared << line
|
42
|
+
end
|
43
|
+
cleared
|
44
44
|
end
|
45
45
|
|
46
46
|
attr_accessor :attached
|
47
|
-
attr_accessor :cli_debug, :xml_debug, :evaluation_timeout
|
47
|
+
attr_accessor :cli_debug, :xml_debug, :evaluation_timeout, :trace_to_s
|
48
48
|
attr_accessor :control_thread
|
49
49
|
attr_reader :interface
|
50
50
|
# protocol extensions
|
@@ -13,21 +13,29 @@ module Debugger
|
|
13
13
|
SPECIAL_SYMBOL_MESSAGE = lambda {|e| '<?>'}
|
14
14
|
end
|
15
15
|
|
16
|
-
class ExecError
|
16
|
+
class ExecError
|
17
17
|
attr_reader :message
|
18
|
-
attr_reader :trace_point
|
19
18
|
attr_reader :backtrace
|
20
19
|
|
21
|
-
def initialize(message,
|
20
|
+
def initialize(message, backtrace = [])
|
22
21
|
@message = message
|
23
|
-
@trace_point = trace_point
|
24
22
|
@backtrace = backtrace
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
28
|
-
class
|
26
|
+
class SimpleTimeLimitError < StandardError
|
27
|
+
attr_reader :message
|
28
|
+
|
29
|
+
def initialize(message)
|
30
|
+
@message = message
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class MemoryLimitError < ExecError;
|
35
|
+
end
|
29
36
|
|
30
|
-
class TimeLimitError < ExecError;
|
37
|
+
class TimeLimitError < ExecError;
|
38
|
+
end
|
31
39
|
|
32
40
|
class XmlPrinter # :nodoc:
|
33
41
|
class ExceptionProxy
|
@@ -163,48 +171,76 @@ module Debugger
|
|
163
171
|
end
|
164
172
|
end
|
165
173
|
|
174
|
+
def exec_with_timeout(sec, error_message)
|
175
|
+
return yield if sec == nil or sec.zero?
|
176
|
+
if Thread.respond_to?(:critical) and Thread.critical
|
177
|
+
raise ThreadError, "timeout within critical session"
|
178
|
+
end
|
179
|
+
begin
|
180
|
+
x = Thread.current
|
181
|
+
y = DebugThread.start {
|
182
|
+
sleep sec
|
183
|
+
x.raise SimpleTimeLimitError.new(error_message) if x.alive?
|
184
|
+
}
|
185
|
+
yield sec
|
186
|
+
ensure
|
187
|
+
y.kill if y and y.alive?
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
166
191
|
def exec_with_allocation_control(value, memory_limit, time_limit, exec_method, overflow_message_type)
|
167
|
-
return value.send exec_method if
|
192
|
+
return value.send exec_method if !Debugger.trace_to_s
|
193
|
+
return exec_with_timeout(time_limit * 1e-3, "Timeout: evaluation of #{exec_method} took longer than #{time_limit}ms.") {value.send exec_method} if defined?(JRUBY_VERSION) || memory_limit <= 0 || (RUBY_VERSION < '2.0' && time_limit > 0)
|
194
|
+
|
168
195
|
|
169
|
-
check_memory_limit = !defined?(JRUBY_VERSION) && ENV['DEBUGGER_MEMORY_LIMIT'].to_i > 0
|
170
196
|
curr_thread = Thread.current
|
197
|
+
control_thread = Debugger.control_thread
|
171
198
|
|
172
199
|
result = nil
|
200
|
+
|
201
|
+
trace_queue = Queue.new
|
202
|
+
|
173
203
|
inspect_thread = DebugThread.start do
|
174
|
-
start_alloc_size = ObjectSpace.memsize_of_all
|
204
|
+
start_alloc_size = ObjectSpace.memsize_of_all
|
175
205
|
start_time = Time.now.to_f
|
176
206
|
|
177
|
-
trace_point = TracePoint.new(:c_call, :call) do |
|
178
|
-
next unless Thread.current == inspect_thread
|
179
|
-
next unless rand > 0.75
|
180
|
-
|
207
|
+
trace_point = TracePoint.new(:c_call, :call) do |tp|
|
181
208
|
curr_time = Time.now.to_f
|
182
209
|
|
183
210
|
if (curr_time - start_time) * 1e3 > time_limit
|
184
|
-
|
211
|
+
trace_queue << TimeLimitError.new("Timeout: evaluation of #{exec_method} took longer than #{time_limit}ms.", caller.to_a)
|
212
|
+
trace_point.disable
|
213
|
+
inspect_thread.kill
|
185
214
|
end
|
186
215
|
|
187
|
-
|
188
|
-
curr_alloc_size = ObjectSpace.memsize_of_all
|
189
|
-
start_alloc_size = curr_alloc_size if curr_alloc_size < start_alloc_size
|
216
|
+
next unless rand > 0.75
|
190
217
|
|
191
|
-
|
192
|
-
|
193
|
-
|
218
|
+
curr_alloc_size = ObjectSpace.memsize_of_all
|
219
|
+
start_alloc_size = curr_alloc_size if curr_alloc_size < start_alloc_size
|
220
|
+
|
221
|
+
if curr_alloc_size - start_alloc_size > 1e6 * memory_limit
|
222
|
+
trace_queue << MemoryLimitError.new("Out of memory: evaluation of #{exec_method} took more than #{memory_limit}mb.", caller.to_a)
|
223
|
+
trace_point.disable
|
224
|
+
inspect_thread.kill
|
194
225
|
end
|
195
226
|
end
|
196
227
|
trace_point.enable
|
197
228
|
result = value.send exec_method
|
229
|
+
trace_queue << result
|
198
230
|
trace_point.disable
|
199
231
|
end
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
232
|
+
|
233
|
+
while(mes = trace_queue.pop)
|
234
|
+
if(mes.is_a? TimeLimitError or mes.is_a? MemoryLimitError)
|
235
|
+
print_debug(mes.message + "\n" + mes.backtrace.map {|l| "\t#{l}"}.join("\n"))
|
236
|
+
return overflow_message_type.call(mes)
|
237
|
+
else
|
238
|
+
return mes
|
239
|
+
end
|
240
|
+
end
|
241
|
+
rescue SimpleTimeLimitError => e
|
242
|
+
print_debug(e.message)
|
205
243
|
return overflow_message_type.call(e)
|
206
|
-
ensure
|
207
|
-
inspect_thread.kill if inspect_thread && inspect_thread.alive?
|
208
244
|
end
|
209
245
|
|
210
246
|
def print_variable(name, value, kind)
|
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.6.1.beta9
|
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: 2017-
|
11
|
+
date: 2017-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: 1.3.1
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project: debug-commons
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.5.1
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: IDE interface for ruby-debug.
|