ruby-debug-ide 0.6.1.beta7 → 0.6.1.beta8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a74a2dbac3d18cf49bd2358b17bec396e0f56132
|
4
|
+
data.tar.gz: 1320ff44faab25776a1fed25921687f029a395af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 767971a4b4a68bcf4daa925e7bdfc09a78a531d47a6780ebd697adb727ea4f6d11175c0957b33739bbb284f207084686833ec9078a097c2d8c1c6fe400b6a600
|
7
|
+
data.tar.gz: 664dd472e6e8672e3fb4e1d71be8b5be9a4af3bab4011c1ea0d43dd668a11327015bfe83c3852f602c1ae3716fd3ae273d779f1536d271d03b8a1327cf0c9966
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'ruby-debug-ide/attach/lldb'
|
2
2
|
require 'ruby-debug-ide/attach/gdb'
|
3
3
|
require 'socket'
|
4
|
+
require 'set'
|
4
5
|
|
5
6
|
def attach_and_return_thread(options, pid, debugger_loader_path, argv)
|
6
7
|
Thread.new(argv) do |argv|
|
@@ -57,7 +58,7 @@ def get_child_pids(pid)
|
|
57
58
|
q = Queue.new
|
58
59
|
q.push(pid)
|
59
60
|
|
60
|
-
|
61
|
+
until q.empty? do
|
61
62
|
pid = q.pop
|
62
63
|
|
63
64
|
pipe = IO.popen("pgrep -P #{pid}")
|
@@ -69,7 +70,25 @@ def get_child_pids(pid)
|
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
72
|
-
pids
|
73
|
+
filter_ruby_processes(pids)
|
74
|
+
end
|
75
|
+
|
76
|
+
def filter_ruby_processes(pids)
|
77
|
+
pipe = IO.popen(%Q(lsof -c ruby | awk '{print $2 ":" $9}' | grep -E 'bin/ruby([[:digit:]]+\.?)*$'))
|
78
|
+
|
79
|
+
ruby_processes = Set.new
|
80
|
+
|
81
|
+
pipe.readlines.each do |process|
|
82
|
+
pid = process.split(/:/).first
|
83
|
+
ruby_processes.add(pid.to_i)
|
84
|
+
end
|
85
|
+
|
86
|
+
ruby_processes_pids, non_ruby_processes_pids = pids.partition {|pid| ruby_processes.include? pid}
|
87
|
+
|
88
|
+
DebugPrinter.print_debug("The following child processes was added to attach: #{ruby_processes_pids.join(', ')}") unless ruby_processes_pids.empty?
|
89
|
+
DebugPrinter.print_debug("The following child are not ruby processes: #{non_ruby_processes_pids.join(', ')}") unless non_ruby_processes_pids.empty?
|
90
|
+
|
91
|
+
ruby_processes_pids
|
73
92
|
end
|
74
93
|
|
75
94
|
def command_exists(command)
|
@@ -93,4 +112,4 @@ def choose_debugger(ruby_path, pid, gems_to_include, debugger_loader_path, argv)
|
|
93
112
|
end
|
94
113
|
|
95
114
|
debugger
|
96
|
-
end
|
115
|
+
end
|
@@ -118,7 +118,7 @@ module Debugger
|
|
118
118
|
def debug_eval(str, b = get_binding)
|
119
119
|
begin
|
120
120
|
str = str.to_s
|
121
|
-
str.force_encoding('UTF-8') if(RUBY_VERSION
|
121
|
+
str.force_encoding('UTF-8') if(RUBY_VERSION >= '2.0')
|
122
122
|
to_inspect = Command.unescape_incoming(str)
|
123
123
|
max_time = Debugger.evaluation_timeout
|
124
124
|
@printer.print_debug("Evaluating %s with timeout after %i sec", str, max_time)
|
@@ -16,7 +16,8 @@ module Debugger
|
|
16
16
|
'tracing' => false,
|
17
17
|
'int_handler' => true,
|
18
18
|
'cli_debug' => (ENV['DEBUGGER_CLI_DEBUG'] == 'true'),
|
19
|
-
'notify_dispatcher' => true
|
19
|
+
'notify_dispatcher' => true,
|
20
|
+
'evaluation_timeout' => 10
|
20
21
|
)
|
21
22
|
|
22
23
|
if(options.ignore_port)
|
@@ -43,6 +44,7 @@ module Debugger
|
|
43
44
|
# set options
|
44
45
|
Debugger.keep_frame_binding = options.frame_bind
|
45
46
|
Debugger.tracing = options.tracing
|
47
|
+
Debugger.evaluation_timeout = options.evaluation_timeout
|
46
48
|
Debugger.cli_debug = options.cli_debug
|
47
49
|
Debugger.prepare_debugger(options)
|
48
50
|
end
|
@@ -13,25 +13,21 @@ module Debugger
|
|
13
13
|
SPECIAL_SYMBOL_MESSAGE = lambda {|e| '<?>'}
|
14
14
|
end
|
15
15
|
|
16
|
-
class
|
16
|
+
class ExecError < StandardError
|
17
17
|
attr_reader :message
|
18
|
+
attr_reader :trace_point
|
18
19
|
attr_reader :backtrace
|
19
20
|
|
20
|
-
def initialize(message, backtrace = [])
|
21
|
+
def initialize(message, trace_point, backtrace = [])
|
21
22
|
@message = message
|
23
|
+
@trace_point = trace_point
|
22
24
|
@backtrace = backtrace
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
26
|
-
class
|
27
|
-
attr_reader :message
|
28
|
-
attr_reader :backtrace
|
28
|
+
class MemoryLimitError < ExecError; end
|
29
29
|
|
30
|
-
|
31
|
-
@message = message
|
32
|
-
@backtrace = backtrace
|
33
|
-
end
|
34
|
-
end
|
30
|
+
class TimeLimitError < ExecError; end
|
35
31
|
|
36
32
|
class XmlPrinter # :nodoc:
|
37
33
|
class ExceptionProxy
|
@@ -168,47 +164,47 @@ module Debugger
|
|
168
164
|
end
|
169
165
|
|
170
166
|
def exec_with_allocation_control(value, memory_limit, time_limit, exec_method, overflow_message_type)
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
end
|
167
|
+
return value.send exec_method if RUBY_VERSION < '2.0'
|
168
|
+
|
169
|
+
check_memory_limit = !defined?(JRUBY_VERSION) && ENV['DEBUGGER_MEMORY_LIMIT'].to_i > 0
|
175
170
|
curr_thread = Thread.current
|
176
|
-
result = nil
|
177
|
-
inspect_thread = DebugThread.start {
|
178
171
|
|
179
|
-
|
172
|
+
result = nil
|
173
|
+
inspect_thread = DebugThread.start do
|
174
|
+
start_alloc_size = ObjectSpace.memsize_of_all if check_memory_limit
|
180
175
|
start_time = Time.now.to_f
|
181
176
|
|
182
|
-
|
177
|
+
trace_point = TracePoint.new(:c_call, :call) do | |
|
178
|
+
next unless Thread.current == inspect_thread
|
179
|
+
next unless rand > 0.75
|
183
180
|
|
184
|
-
|
185
|
-
curr_time = Time.now.to_f
|
181
|
+
curr_time = Time.now.to_f
|
186
182
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
end
|
183
|
+
if (curr_time - start_time) * 1e3 > time_limit
|
184
|
+
curr_thread.raise TimeLimitError.new("Timeout: evaluation of #{exec_method} took longer than #{time_limit}ms.", trace_point, caller.to_a)
|
185
|
+
end
|
191
186
|
|
192
|
-
|
193
|
-
|
194
|
-
|
187
|
+
if check_memory_limit
|
188
|
+
curr_alloc_size = ObjectSpace.memsize_of_all
|
189
|
+
start_alloc_size = curr_alloc_size if curr_alloc_size < start_alloc_size
|
195
190
|
|
196
|
-
|
197
|
-
|
198
|
-
inspect_thread.kill
|
199
|
-
end
|
191
|
+
if curr_alloc_size - start_alloc_size > 1e6 * memory_limit
|
192
|
+
curr_thread.raise MemoryLimitError.new("Out of memory: evaluation of #{exec_method} took more than #{memory_limit}mb.", trace_point, caller.to_a)
|
200
193
|
end
|
201
194
|
end
|
202
|
-
end
|
203
|
-
|
204
|
-
|
205
|
-
|
195
|
+
end
|
196
|
+
trace_point.enable
|
197
|
+
result = value.send exec_method
|
198
|
+
trace_point.disable
|
199
|
+
end
|
206
200
|
inspect_thread.join
|
207
|
-
inspect_thread.kill
|
208
201
|
return result
|
209
|
-
rescue
|
210
|
-
|
202
|
+
rescue ExecError => e
|
203
|
+
e.trace_point.disable
|
204
|
+
print_debug(e.message + "\n" + e.backtrace.map {|l| "\t#{l}"}.join("\n"))
|
211
205
|
return overflow_message_type.call(e)
|
206
|
+
ensure
|
207
|
+
inspect_thread.kill if inspect_thread && inspect_thread.alive?
|
212
208
|
end
|
213
209
|
|
214
210
|
def print_variable(name, value, kind)
|
@@ -512,4 +508,4 @@ module Debugger
|
|
512
508
|
|
513
509
|
end
|
514
510
|
|
515
|
-
end
|
511
|
+
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.6.1.beta8
|
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-08-
|
11
|
+
date: 2017-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|