ruby-debug-ide 0.4.16 → 0.4.17.beta3
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/Rakefile +1 -1
- data/ext/mkrf_conf.rb +16 -6
- data/lib/ruby-debug/commands/jump.rb +0 -0
- data/lib/ruby-debug/commands/pause.rb +0 -0
- data/lib/ruby-debug/commands/set_type.rb +0 -0
- data/lib/ruby-debug/event_processor.rb +2 -3
- data/lib/ruby-debug/interface.rb +5 -1
- data/lib/ruby-debug/processor.rb +59 -52
- data/lib/ruby-debug/version.rb +1 -1
- data/lib/ruby-debug/xml_printer.rb +52 -0
- metadata +26 -23
data/Rakefile
CHANGED
@@ -43,7 +43,7 @@ EOF
|
|
43
43
|
spec.executables = ["rdebug-ide"]
|
44
44
|
spec.files = FILES.to_a
|
45
45
|
|
46
|
-
spec.extensions << "ext/mkrf_conf.rb"
|
46
|
+
spec.extensions << "ext/mkrf_conf.rb" unless ENV['NO_EXT']
|
47
47
|
spec.add_dependency("rake", ">= 0.8.1")
|
48
48
|
|
49
49
|
spec.required_ruby_version = '>= 1.8.2'
|
data/ext/mkrf_conf.rb
CHANGED
@@ -2,6 +2,7 @@ jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENG
|
|
2
2
|
unless jruby
|
3
3
|
require 'rubygems'
|
4
4
|
require 'rubygems/command.rb'
|
5
|
+
require 'rubygems/dependency.rb'
|
5
6
|
require 'rubygems/dependency_installer.rb'
|
6
7
|
|
7
8
|
begin
|
@@ -9,15 +10,24 @@ unless jruby
|
|
9
10
|
rescue NoMethodError
|
10
11
|
end
|
11
12
|
|
13
|
+
if RUBY_VERSION < "1.9"
|
14
|
+
dep = Gem::Dependency.new("ruby-debug-base", '>=0.10.4')
|
15
|
+
else
|
16
|
+
dep = Gem::Dependency.new("ruby-debug-base19x", '>=0.11.24')
|
17
|
+
end
|
18
|
+
|
12
19
|
inst = Gem::DependencyInstaller.new
|
13
20
|
begin
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
rescue
|
21
|
+
inst.install dep
|
22
|
+
rescue
|
23
|
+
inst = Gem::DependencyInstaller.new(:prerelease => true)
|
24
|
+
begin
|
25
|
+
inst.install dep
|
26
|
+
rescue Exception => e
|
27
|
+
puts e
|
28
|
+
puts e.backtrace.join "\n "
|
20
29
|
exit(1)
|
30
|
+
end
|
21
31
|
end
|
22
32
|
end
|
23
33
|
|
File without changes
|
File without changes
|
File without changes
|
@@ -11,6 +11,7 @@ end
|
|
11
11
|
|
12
12
|
def initialize(interface)
|
13
13
|
@printer = XmlPrinter.new(interface)
|
14
|
+
@interface = interface
|
14
15
|
@line = nil
|
15
16
|
@file = nil
|
16
17
|
@last_breakpoint = nil
|
@@ -57,9 +58,7 @@ end
|
|
57
58
|
raise "DebuggerThread are not supposed to be traced (#{context.thread})" if context.thread.is_a?(Debugger::DebugThread)
|
58
59
|
@printer.print_debug("Stopping Thread %s", context.thread.to_s)
|
59
60
|
@printer.print_debug("Threads equal: %s", Thread.current == context.thread)
|
60
|
-
|
61
|
-
# from `control thread'
|
62
|
-
Thread.stop
|
61
|
+
CommandProcessor.new(@interface).process_commands
|
63
62
|
@printer.print_debug("Resumed Thread %s", context.thread.to_s)
|
64
63
|
@line = nil
|
65
64
|
@file = nil
|
data/lib/ruby-debug/interface.rb
CHANGED
@@ -12,11 +12,15 @@ class TCPSocket
|
|
12
12
|
end
|
13
13
|
|
14
14
|
module Debugger
|
15
|
+
class Interface
|
16
|
+
end
|
15
17
|
|
16
|
-
class RemoteInterface # :nodoc:
|
18
|
+
class RemoteInterface < Interface # :nodoc:
|
19
|
+
attr_accessor :command_queue
|
17
20
|
|
18
21
|
def initialize(socket)
|
19
22
|
@socket = socket
|
23
|
+
@command_queue = []
|
20
24
|
end
|
21
25
|
|
22
26
|
def read_command
|
data/lib/ruby-debug/processor.rb
CHANGED
@@ -7,50 +7,17 @@ else
|
|
7
7
|
end
|
8
8
|
|
9
9
|
module Debugger
|
10
|
-
# this class is added to resolve problems, with ruby-debug gem incompatibility see
|
11
|
-
# http://rubyforge.org/tracker/index.php?func=detail&aid=27055&group_id=3085&atid=11903
|
12
10
|
class CommandProcessor
|
13
|
-
|
14
|
-
|
15
|
-
class ControlCommandProcessor # :nodoc:
|
16
|
-
def initialize(interface)
|
11
|
+
def initialize(interface = nil)
|
17
12
|
@interface = interface
|
18
13
|
@printer = XmlPrinter.new(@interface)
|
19
14
|
end
|
20
|
-
|
15
|
+
|
21
16
|
def print(*args)
|
22
17
|
@interface.print(*args)
|
23
18
|
end
|
24
|
-
|
19
|
+
|
25
20
|
def process_commands
|
26
|
-
@printer.print_debug("Starting command read loop")
|
27
|
-
ctrl_cmd_classes = Command.commands.select{|cmd| cmd.control}
|
28
|
-
state = ControlState.new(@interface)
|
29
|
-
ctrl_cmds = ctrl_cmd_classes.map{|cmd| cmd.new(state, @printer)}
|
30
|
-
|
31
|
-
while input = @interface.read_command
|
32
|
-
# escape % since print_debug might use printf
|
33
|
-
@printer.print_debug "Processing: #{input.gsub('%', '%%')}"
|
34
|
-
# sleep 0.3
|
35
|
-
catch(:debug_error) do
|
36
|
-
if cmd = ctrl_cmds.find{|c| c.match(input) }
|
37
|
-
cmd.execute
|
38
|
-
else
|
39
|
-
process_context_commands(input)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
rescue IOError, Errno::EPIPE
|
44
|
-
@printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
|
45
|
-
@printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
|
46
|
-
rescue Exception
|
47
|
-
@printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
|
48
|
-
@printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
|
49
|
-
ensure
|
50
|
-
@interface.close
|
51
|
-
end
|
52
|
-
|
53
|
-
def process_context_commands(input)
|
54
21
|
unless Debugger.event_processor.at_line?
|
55
22
|
@printer.print_error "There is no thread suspended at the time and therefore no context to execute '#{input.gsub('%', '%%')}'"
|
56
23
|
return
|
@@ -58,7 +25,6 @@ module Debugger
|
|
58
25
|
context = Debugger.event_processor.context
|
59
26
|
file = Debugger.event_processor.file
|
60
27
|
line = Debugger.event_processor.line
|
61
|
-
event_cmds_classes = Command.commands.select{|cmd| cmd.event}
|
62
28
|
state = State.new do |s|
|
63
29
|
s.context = context
|
64
30
|
s.file = file
|
@@ -66,28 +32,39 @@ module Debugger
|
|
66
32
|
s.binding = context.frame_binding(0)
|
67
33
|
s.interface = @interface
|
68
34
|
end
|
69
|
-
event_cmds =
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
35
|
+
event_cmds = Command.commands.map{|cmd| cmd.new(state, @printer) }
|
36
|
+
while !state.proceed? do
|
37
|
+
input = @interface.command_queue.empty? ? nil : @interface.command_queue.shift
|
38
|
+
unless input
|
39
|
+
sleep 0.1
|
40
|
+
next
|
41
|
+
end
|
42
|
+
catch(:debug_error) do
|
43
|
+
splitter[input].each do |input|
|
44
|
+
# escape % since print_debug might use printf
|
45
|
+
@printer.print_debug "Processing in context: #{input.gsub('%', '%%')}"
|
46
|
+
if cmd = event_cmds.find { |c| c.match(input) }
|
47
|
+
if context.dead? && cmd.class.need_context
|
48
|
+
@printer.print_msg "Command is unavailable\n"
|
49
|
+
else
|
50
|
+
cmd.execute
|
51
|
+
end
|
77
52
|
else
|
78
|
-
|
53
|
+
@printer.print_msg "Unknown command: #{input}"
|
79
54
|
end
|
80
|
-
else
|
81
|
-
@printer.print_msg "Unknown command: #{input}"
|
82
55
|
end
|
83
56
|
end
|
84
57
|
end
|
85
|
-
|
86
|
-
|
58
|
+
rescue IOError, Errno::EPIPE
|
59
|
+
@printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
|
60
|
+
@printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
|
61
|
+
rescue Exception
|
62
|
+
@printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
|
63
|
+
@printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
|
87
64
|
end
|
88
|
-
|
65
|
+
|
89
66
|
def splitter
|
90
|
-
|
67
|
+
lambda do |str|
|
91
68
|
str.split(/;/).inject([]) do |m, v|
|
92
69
|
if m.empty?
|
93
70
|
m << v
|
@@ -102,6 +79,36 @@ module Debugger
|
|
102
79
|
m
|
103
80
|
end
|
104
81
|
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
class ControlCommandProcessor < CommandProcessor# :nodoc:
|
86
|
+
def process_commands
|
87
|
+
@printer.print_debug("Starting control thread")
|
88
|
+
ctrl_cmd_classes = Command.commands.select{|cmd| cmd.control}
|
89
|
+
state = ControlState.new(@interface)
|
90
|
+
ctrl_cmds = ctrl_cmd_classes.map{|cmd| cmd.new(state, @printer)}
|
91
|
+
|
92
|
+
while input = @interface.read_command
|
93
|
+
# escape % since print_debug might use printf
|
94
|
+
# sleep 0.3
|
95
|
+
catch(:debug_error) do
|
96
|
+
if cmd = ctrl_cmds.find{|c| c.match(input) }
|
97
|
+
@printer.print_debug "Processing in control: #{input.gsub('%', '%%')}"
|
98
|
+
cmd.execute
|
99
|
+
else
|
100
|
+
@interface.command_queue << input
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
rescue IOError, Errno::EPIPE
|
105
|
+
@printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
|
106
|
+
@printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
|
107
|
+
rescue Exception
|
108
|
+
@printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
|
109
|
+
@printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
|
110
|
+
ensure
|
111
|
+
@interface.close
|
105
112
|
end
|
106
113
|
end
|
107
114
|
|
data/lib/ruby-debug/version.rb
CHANGED
@@ -1,9 +1,51 @@
|
|
1
1
|
require 'cgi'
|
2
2
|
require 'yaml'
|
3
|
+
require 'monitor'
|
3
4
|
|
4
5
|
module Debugger
|
5
6
|
|
6
7
|
class XmlPrinter # :nodoc:
|
8
|
+
class ExceptionProxy
|
9
|
+
instance_methods.each { |m| undef_method m unless m =~ /(^__|^send$|^object_id$|^instance_variables$|^instance_eval$)/ }
|
10
|
+
|
11
|
+
def initialize(exception)
|
12
|
+
@exception = exception
|
13
|
+
@message = exception.message
|
14
|
+
@backtrace = cleanup_backtrace(exception.backtrace)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def method_missing(called, *args, &block)
|
19
|
+
@exception.__send__(called, *args, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def cleanup_backtrace(backtrace)
|
23
|
+
cleared = []
|
24
|
+
return cleared unless backtrace
|
25
|
+
backtrace.each do |line|
|
26
|
+
if line.index(File.expand_path(File.dirname(__FILE__))) == 0
|
27
|
+
break
|
28
|
+
end
|
29
|
+
cleared << line
|
30
|
+
end
|
31
|
+
cleared
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.protect(mname)
|
36
|
+
return if instance_methods.include?("__#{mname}")
|
37
|
+
alias_method "__#{mname}", mname
|
38
|
+
class_eval %{
|
39
|
+
def #{mname}(*args, &block)
|
40
|
+
@@monitor.synchronize do
|
41
|
+
return unless @interface
|
42
|
+
__#{mname}(*args, &block)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
@@monitor = Monitor.new
|
7
49
|
attr_accessor :interface
|
8
50
|
|
9
51
|
def initialize(interface)
|
@@ -229,6 +271,10 @@ module Debugger
|
|
229
271
|
end
|
230
272
|
|
231
273
|
def print_exception(exception, binding)
|
274
|
+
print_variables(%w(error), 'exception') do |var|
|
275
|
+
ExceptionProxy.new(exception)
|
276
|
+
end
|
277
|
+
rescue
|
232
278
|
print "<processingException type=\"%s\" message=\"%s\"/>",
|
233
279
|
exception.class, CGI.escapeHTML(exception.to_s)
|
234
280
|
end
|
@@ -262,6 +308,12 @@ module Debugger
|
|
262
308
|
Debugger::print_debug(*params)
|
263
309
|
@interface.print(*params)
|
264
310
|
end
|
311
|
+
|
312
|
+
instance_methods.each do |m|
|
313
|
+
if m.to_s.index('print_') == 0
|
314
|
+
protect m
|
315
|
+
end
|
316
|
+
end
|
265
317
|
|
266
318
|
end
|
267
319
|
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-debug-ide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 299253551
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
|
9
|
+
- 17
|
10
|
+
- beta3
|
11
|
+
version: 0.4.17.beta3
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Markus Barchfeld, Martin Krauskopf, Mark Moseley, JetBrains RubyMine Team
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date:
|
19
|
+
date: 2011-02-14 00:00:00 +03:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -48,30 +49,30 @@ files:
|
|
48
49
|
- MIT-LICENSE
|
49
50
|
- Rakefile
|
50
51
|
- bin/rdebug-ide
|
51
|
-
- lib/ruby-debug
|
52
|
-
- lib/ruby-debug/
|
52
|
+
- lib/ruby-debug-ide.rb
|
53
|
+
- lib/ruby-debug/printers.rb
|
54
|
+
- lib/ruby-debug/helper.rb
|
53
55
|
- lib/ruby-debug/commands/catchpoint.rb
|
54
|
-
- lib/ruby-debug/commands/condition.rb
|
55
|
-
- lib/ruby-debug/commands/control.rb
|
56
|
-
- lib/ruby-debug/commands/enable.rb
|
57
|
-
- lib/ruby-debug/commands/eval.rb
|
58
56
|
- lib/ruby-debug/commands/frame.rb
|
59
57
|
- lib/ruby-debug/commands/inspect.rb
|
60
|
-
- lib/ruby-debug/commands/
|
58
|
+
- lib/ruby-debug/commands/condition.rb
|
59
|
+
- lib/ruby-debug/commands/variables.rb
|
61
60
|
- lib/ruby-debug/commands/load.rb
|
62
|
-
- lib/ruby-debug/commands/pause.rb
|
63
61
|
- lib/ruby-debug/commands/set_type.rb
|
62
|
+
- lib/ruby-debug/commands/enable.rb
|
63
|
+
- lib/ruby-debug/commands/control.rb
|
64
|
+
- lib/ruby-debug/commands/jump.rb
|
64
65
|
- lib/ruby-debug/commands/stepping.rb
|
66
|
+
- lib/ruby-debug/commands/pause.rb
|
65
67
|
- lib/ruby-debug/commands/threads.rb
|
66
|
-
- lib/ruby-debug/commands/
|
68
|
+
- lib/ruby-debug/commands/breakpoints.rb
|
69
|
+
- lib/ruby-debug/commands/eval.rb
|
70
|
+
- lib/ruby-debug/command.rb
|
71
|
+
- lib/ruby-debug/xml_printer.rb
|
67
72
|
- lib/ruby-debug/event_processor.rb
|
68
|
-
- lib/ruby-debug/helper.rb
|
69
73
|
- lib/ruby-debug/interface.rb
|
70
|
-
- lib/ruby-debug/printers.rb
|
71
|
-
- lib/ruby-debug/processor.rb
|
72
74
|
- lib/ruby-debug/version.rb
|
73
|
-
- lib/ruby-debug/
|
74
|
-
- lib/ruby-debug-ide.rb
|
75
|
+
- lib/ruby-debug/processor.rb
|
75
76
|
- ext/mkrf_conf.rb
|
76
77
|
has_rdoc: true
|
77
78
|
homepage: http://rubyforge.org/projects/debug-commons/
|
@@ -96,12 +97,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
98
|
none: false
|
98
99
|
requirements:
|
99
|
-
- - "
|
100
|
+
- - ">"
|
100
101
|
- !ruby/object:Gem::Version
|
101
|
-
hash:
|
102
|
+
hash: 25
|
102
103
|
segments:
|
103
|
-
-
|
104
|
-
|
104
|
+
- 1
|
105
|
+
- 3
|
106
|
+
- 1
|
107
|
+
version: 1.3.1
|
105
108
|
requirements: []
|
106
109
|
|
107
110
|
rubyforge_project: debug-commons
|