debugger-xml 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/rdebug-ide +12 -9
- data/bin/rdebug-vim +30 -13
- data/debugger-xml.gemspec +7 -3
- data/lib/byebug/commands/frame.rb +16 -0
- data/lib/byebug/commands/help.rb +13 -0
- data/lib/byebug/commands/info.rb +13 -0
- data/lib/byebug/commands/inspect.rb +30 -0
- data/lib/byebug/commands/kill.rb +13 -0
- data/lib/byebug/commands/start.rb +25 -0
- data/lib/byebug/commands/threads.rb +10 -0
- data/lib/byebug/commands/trace.rb +13 -0
- data/lib/byebug/commands/variables.rb +54 -0
- data/lib/byebug/context_xml.rb +29 -0
- data/lib/byebug/printers/texts/xml.yml +122 -0
- data/lib/byebug/printers/xml.rb +197 -0
- data/lib/debugger/{xml/extensions/processor.rb → command_processor.rb} +0 -0
- data/lib/debugger/{xml/extensions/commands → commands}/edit.rb +0 -0
- data/lib/debugger/{xml/extensions/commands → commands}/frame.rb +0 -1
- data/lib/debugger/{xml/extensions/commands → commands}/help.rb +0 -0
- data/lib/debugger/{xml/extensions/commands → commands}/info.rb +0 -0
- data/lib/debugger/{xml/extensions/commands → commands}/inspect.rb +0 -0
- data/lib/debugger/{xml/extensions/commands → commands}/irb.rb +0 -0
- data/lib/debugger/{xml/extensions/commands → commands}/kill.rb +0 -0
- data/lib/debugger/commands/start.rb +25 -0
- data/lib/debugger/{xml/extensions/commands → commands}/threads.rb +0 -0
- data/lib/debugger/{xml/extensions/commands → commands}/tmate.rb +0 -0
- data/lib/debugger/{xml/extensions/commands → commands}/trace.rb +0 -0
- data/lib/debugger/{xml/extensions/commands → commands}/variables.rb +14 -0
- data/lib/debugger_xml.rb +91 -0
- data/lib/debugger_xml/byebug_proxy.rb +108 -0
- data/lib/debugger_xml/debugger_proxy.rb +115 -0
- data/lib/debugger_xml/fake_logger.rb +9 -0
- data/lib/debugger_xml/ide/control_command_processor.rb +69 -0
- data/lib/debugger_xml/ide/interface.rb +74 -0
- data/lib/debugger_xml/ide/logger.rb +9 -0
- data/lib/debugger_xml/ide/processor.rb +118 -0
- data/lib/debugger_xml/multiprocess/monkey.rb +47 -0
- data/lib/debugger_xml/multiprocess/pre_child.rb +79 -0
- data/lib/{debugger/xml → debugger_xml}/multiprocess/starter.rb +2 -2
- data/lib/debugger_xml/version.rb +3 -0
- data/lib/debugger_xml/vim/control_command_processor.rb +23 -0
- data/lib/debugger_xml/vim/interface.rb +46 -0
- data/lib/debugger_xml/vim/logger.rb +16 -0
- data/lib/debugger_xml/vim/notification.rb +35 -0
- data/lib/debugger_xml/vim/processor.rb +20 -0
- data/test/breakpoints_test.rb +0 -1
- data/test/ide/control_command_processor_test.rb +18 -13
- data/test/ide/processor_test.rb +11 -25
- data/test/printers/xml_test.rb +1 -0
- data/test/test_helper.rb +12 -3
- data/test/variables_test.rb +0 -1
- data/test/vim/control_command_processor_test.rb +4 -5
- data/test/vim/interface_test.rb +6 -6
- data/test/vim/notification_test.rb +3 -3
- data/test/vim/processor_test.rb +8 -8
- metadata +61 -48
- data/lib/debugger/xml.rb +0 -11
- data/lib/debugger/xml/extensions/ide_server.rb +0 -33
- data/lib/debugger/xml/extensions/vim_server.rb +0 -56
- data/lib/debugger/xml/fake_logger.rb +0 -11
- data/lib/debugger/xml/ide/control_command_processor.rb +0 -81
- data/lib/debugger/xml/ide/interface.rb +0 -72
- data/lib/debugger/xml/ide/logger.rb +0 -11
- data/lib/debugger/xml/ide/processor.rb +0 -94
- data/lib/debugger/xml/multiprocess/monkey.rb +0 -49
- data/lib/debugger/xml/multiprocess/pre_child.rb +0 -81
- data/lib/debugger/xml/version.rb +0 -5
- data/lib/debugger/xml/vim/control_command_processor.rb +0 -19
- data/lib/debugger/xml/vim/interface.rb +0 -42
- data/lib/debugger/xml/vim/logger.rb +0 -18
- data/lib/debugger/xml/vim/notification.rb +0 -37
- data/lib/debugger/xml/vim/processor.rb +0 -22
data/test/vim/interface_test.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
|
-
require '
|
2
|
+
require 'debugger_xml/vim/interface'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe DebuggerXml::Vim::Interface do
|
5
5
|
include TestDsl
|
6
6
|
|
7
|
-
let(:klass) {
|
7
|
+
let(:klass) { DebuggerXml::Vim::Interface }
|
8
8
|
let(:options) do
|
9
9
|
stub(debug_mode: false, file: filename, separator: "--sep--")
|
10
10
|
end
|
@@ -22,7 +22,7 @@ describe Debugger::Xml::Vim::Interface do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "must send command to Vim" do
|
25
|
-
|
25
|
+
DebuggerXml::Vim::Notification.expects(:new).with("receive_command", options).returns(notification)
|
26
26
|
subject.print("foo")
|
27
27
|
subject.print("bar")
|
28
28
|
subject.send_response
|
@@ -30,7 +30,7 @@ describe Debugger::Xml::Vim::Interface do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "must clear the queue after sending response" do
|
33
|
-
|
33
|
+
DebuggerXml::Vim::Notification.stubs(:new).with("receive_command", options).returns(notification)
|
34
34
|
subject.print("foo")
|
35
35
|
subject.print("bar")
|
36
36
|
subject.send_response
|
@@ -40,7 +40,7 @@ describe Debugger::Xml::Vim::Interface do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "must not send any command if there is nothing to send" do
|
43
|
-
|
43
|
+
DebuggerXml::Vim::Notification.expects(:new).never
|
44
44
|
subject.send_response
|
45
45
|
File.read(filename).strip.must_equal ""
|
46
46
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
|
-
require '
|
2
|
+
require 'debugger_xml/vim/notification'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe DebuggerXml::Vim::Notification do
|
5
5
|
include TestDsl
|
6
6
|
|
7
|
-
let(:klass) {
|
7
|
+
let(:klass) { DebuggerXml::Vim::Notification }
|
8
8
|
let(:options) do
|
9
9
|
stub(vim_executable: "vim", vim_servername: "VIM", debug_mode: true, logger_file: filename)
|
10
10
|
end
|
data/test/vim/processor_test.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
|
-
require '
|
2
|
+
require 'debugger_xml/vim/processor'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe DebuggerXml::Vim::Processor do
|
5
5
|
include TestDsl
|
6
6
|
|
7
7
|
before { Thread.stubs(:stop) }
|
8
8
|
|
9
|
-
let(:klass) {
|
9
|
+
let(:klass) { DebuggerXml::Vim::Processor }
|
10
10
|
let(:interface) { TestInterface.new }
|
11
11
|
let(:breakpoint) { stub }
|
12
12
|
let(:context) { stub(thread: nil, stop_reason: nil, thnum: 1, stack_size: 2) }
|
13
13
|
let(:file) { fullpath('jump') }
|
14
|
-
subject { klass.new(interface) }
|
14
|
+
subject { klass.new(interface, $proxy) }
|
15
15
|
|
16
16
|
describe "#at_line" do
|
17
17
|
it "must send response" do
|
18
18
|
processor = stub
|
19
19
|
processor.stubs(:process_command).with("where")
|
20
|
-
processor.stubs(:process_command).with("var
|
21
|
-
|
20
|
+
processor.stubs(:process_command).with("var ide")
|
21
|
+
DebuggerXml::Vim::ControlCommandProcessor.stubs(:new).with(interface, $proxy).returns(processor)
|
22
22
|
interface.expects(:send_response)
|
23
23
|
subject.at_line(context, file, 30)
|
24
24
|
end
|
@@ -26,8 +26,8 @@ describe Debugger::Xml::Vim::Processor do
|
|
26
26
|
it "must process additional commands" do
|
27
27
|
processor = stub
|
28
28
|
processor.expects(:process_command).with("where")
|
29
|
-
processor.expects(:process_command).with("var
|
30
|
-
|
29
|
+
processor.expects(:process_command).with("var ide")
|
30
|
+
DebuggerXml::Vim::ControlCommandProcessor.expects(:new).with(interface, $proxy).returns(processor)
|
31
31
|
interface.stubs(:send_response)
|
32
32
|
subject.at_line(context, file, 30)
|
33
33
|
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debugger-xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Astashov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: byebug
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.9.2.2
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.9.2.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.12.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.12.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mocha
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.13.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.13.0
|
83
83
|
description: XML interface for debugger
|
@@ -89,7 +89,7 @@ executables:
|
|
89
89
|
extensions: []
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
|
-
- .gitignore
|
92
|
+
- ".gitignore"
|
93
93
|
- CHANGELOG.md
|
94
94
|
- Gemfile
|
95
95
|
- LICENSE.txt
|
@@ -98,37 +98,50 @@ files:
|
|
98
98
|
- bin/rdebug-ide
|
99
99
|
- bin/rdebug-vim
|
100
100
|
- debugger-xml.gemspec
|
101
|
+
- lib/byebug/commands/frame.rb
|
102
|
+
- lib/byebug/commands/help.rb
|
103
|
+
- lib/byebug/commands/info.rb
|
104
|
+
- lib/byebug/commands/inspect.rb
|
105
|
+
- lib/byebug/commands/kill.rb
|
106
|
+
- lib/byebug/commands/start.rb
|
107
|
+
- lib/byebug/commands/threads.rb
|
108
|
+
- lib/byebug/commands/trace.rb
|
109
|
+
- lib/byebug/commands/variables.rb
|
110
|
+
- lib/byebug/context_xml.rb
|
111
|
+
- lib/byebug/printers/texts/xml.yml
|
112
|
+
- lib/byebug/printers/xml.rb
|
113
|
+
- lib/debugger/command_processor.rb
|
114
|
+
- lib/debugger/commands/edit.rb
|
115
|
+
- lib/debugger/commands/frame.rb
|
116
|
+
- lib/debugger/commands/help.rb
|
117
|
+
- lib/debugger/commands/info.rb
|
118
|
+
- lib/debugger/commands/inspect.rb
|
119
|
+
- lib/debugger/commands/irb.rb
|
120
|
+
- lib/debugger/commands/kill.rb
|
121
|
+
- lib/debugger/commands/start.rb
|
122
|
+
- lib/debugger/commands/threads.rb
|
123
|
+
- lib/debugger/commands/tmate.rb
|
124
|
+
- lib/debugger/commands/trace.rb
|
125
|
+
- lib/debugger/commands/variables.rb
|
101
126
|
- lib/debugger/printers/texts/xml.yml
|
102
127
|
- lib/debugger/printers/xml.rb
|
103
|
-
- lib/
|
104
|
-
- lib/
|
105
|
-
- lib/
|
106
|
-
- lib/
|
107
|
-
- lib/
|
108
|
-
- lib/
|
109
|
-
- lib/
|
110
|
-
- lib/
|
111
|
-
- lib/
|
112
|
-
- lib/
|
113
|
-
- lib/
|
114
|
-
- lib/
|
115
|
-
- lib/
|
116
|
-
- lib/
|
117
|
-
- lib/
|
118
|
-
- lib/
|
119
|
-
- lib/
|
120
|
-
- lib/debugger/xml/ide/interface.rb
|
121
|
-
- lib/debugger/xml/ide/logger.rb
|
122
|
-
- lib/debugger/xml/ide/processor.rb
|
123
|
-
- lib/debugger/xml/multiprocess/monkey.rb
|
124
|
-
- lib/debugger/xml/multiprocess/pre_child.rb
|
125
|
-
- lib/debugger/xml/multiprocess/starter.rb
|
126
|
-
- lib/debugger/xml/version.rb
|
127
|
-
- lib/debugger/xml/vim/control_command_processor.rb
|
128
|
-
- lib/debugger/xml/vim/interface.rb
|
129
|
-
- lib/debugger/xml/vim/logger.rb
|
130
|
-
- lib/debugger/xml/vim/notification.rb
|
131
|
-
- lib/debugger/xml/vim/processor.rb
|
128
|
+
- lib/debugger_xml.rb
|
129
|
+
- lib/debugger_xml/byebug_proxy.rb
|
130
|
+
- lib/debugger_xml/debugger_proxy.rb
|
131
|
+
- lib/debugger_xml/fake_logger.rb
|
132
|
+
- lib/debugger_xml/ide/control_command_processor.rb
|
133
|
+
- lib/debugger_xml/ide/interface.rb
|
134
|
+
- lib/debugger_xml/ide/logger.rb
|
135
|
+
- lib/debugger_xml/ide/processor.rb
|
136
|
+
- lib/debugger_xml/multiprocess/monkey.rb
|
137
|
+
- lib/debugger_xml/multiprocess/pre_child.rb
|
138
|
+
- lib/debugger_xml/multiprocess/starter.rb
|
139
|
+
- lib/debugger_xml/version.rb
|
140
|
+
- lib/debugger_xml/vim/control_command_processor.rb
|
141
|
+
- lib/debugger_xml/vim/interface.rb
|
142
|
+
- lib/debugger_xml/vim/logger.rb
|
143
|
+
- lib/debugger_xml/vim/notification.rb
|
144
|
+
- lib/debugger_xml/vim/processor.rb
|
132
145
|
- test/breakpoints_test.rb
|
133
146
|
- test/conditions_test.rb
|
134
147
|
- test/continue_test.rb
|
@@ -192,17 +205,17 @@ require_paths:
|
|
192
205
|
- lib
|
193
206
|
required_ruby_version: !ruby/object:Gem::Requirement
|
194
207
|
requirements:
|
195
|
-
- -
|
208
|
+
- - ">="
|
196
209
|
- !ruby/object:Gem::Version
|
197
210
|
version: '0'
|
198
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
212
|
requirements:
|
200
|
-
- -
|
213
|
+
- - ">="
|
201
214
|
- !ruby/object:Gem::Version
|
202
215
|
version: '0'
|
203
216
|
requirements: []
|
204
217
|
rubyforge_project:
|
205
|
-
rubygems_version: 2.
|
218
|
+
rubygems_version: 2.2.2
|
206
219
|
signing_key:
|
207
220
|
specification_version: 4
|
208
221
|
summary: Implements XML interface for the 'debugger' gem, compatible with ruby-debug-ide
|
data/lib/debugger/xml.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
module Debugger
|
2
|
-
class << self
|
3
|
-
attr_accessor :wait_for_start, :control_thread
|
4
|
-
|
5
|
-
def start_remote_ide(host, port)
|
6
|
-
return if @control_thread
|
7
|
-
@mutex = Mutex.new
|
8
|
-
@proceed = ConditionVariable.new
|
9
|
-
start
|
10
|
-
@control_thread = DebugThread.new do
|
11
|
-
server = TCPServer.new(host, port)
|
12
|
-
$stderr.printf "Fast Debugger (debugger-xml #{Xml::VERSION}) listens on #{host}:#{port}\n"
|
13
|
-
while (session = server.accept)
|
14
|
-
dispatcher = ENV['IDE_PROCESS_DISPATCHER']
|
15
|
-
if dispatcher && !dispatcher.include?(":")
|
16
|
-
ENV['IDE_PROCESS_DISPATCHER'] = "#{session.peeraddr[2]}:#{dispatcher}"
|
17
|
-
end
|
18
|
-
interface = Xml::Ide::Interface.new(session)
|
19
|
-
processor = Xml::Ide::ControlCommandProcessor.new(interface)
|
20
|
-
self.handler = Xml::Ide::Processor.new(interface)
|
21
|
-
processor.process_commands
|
22
|
-
end
|
23
|
-
end
|
24
|
-
@mutex.synchronize { @proceed.wait(@mutex) } if wait_for_start
|
25
|
-
end
|
26
|
-
|
27
|
-
def proceed
|
28
|
-
return unless @mutex
|
29
|
-
@mutex.synchronize { @proceed.signal }
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require_relative 'ide_server'
|
2
|
-
|
3
|
-
module Debugger
|
4
|
-
class << self
|
5
|
-
|
6
|
-
def start_for_vim(options)
|
7
|
-
return if @control_thread
|
8
|
-
Xml.logger.puts("Going to daemonize");
|
9
|
-
daemonize!
|
10
|
-
Xml.logger.puts("Successfully daemonized");
|
11
|
-
$stdout.reopen(options.output_file, 'w')
|
12
|
-
$stdout.sync
|
13
|
-
$stderr.reopen($stdout)
|
14
|
-
Xml.logger.puts("Redirected stderr");
|
15
|
-
@mutex = Mutex.new
|
16
|
-
@proceed = ConditionVariable.new
|
17
|
-
start
|
18
|
-
Xml.logger.puts("Started debugger");
|
19
|
-
File.unlink(options.socket) if File.exist?(options.socket)
|
20
|
-
server = UNIXServer.new(options.socket)
|
21
|
-
Xml::Vim::Notification.new("establish_connection", options).send
|
22
|
-
Xml.logger.puts("Sent 'established_connection' command");
|
23
|
-
@control_thread = DebugThread.new do
|
24
|
-
begin
|
25
|
-
while (session = server.accept)
|
26
|
-
Xml.logger.puts("Accepted connection");
|
27
|
-
interface = Xml::Vim::Interface.new(session, options)
|
28
|
-
processor = Xml::Vim::ControlCommandProcessor.new(interface)
|
29
|
-
self.handler = Xml::Vim::Processor.new(interface)
|
30
|
-
Xml.logger.puts("Going to process commands");
|
31
|
-
processor.process_commands
|
32
|
-
end
|
33
|
-
rescue Exception => e
|
34
|
-
Xml.logger.puts("INTERNAL ERROR!!! #{$!}") rescue nil
|
35
|
-
Xml.logger.puts($!.backtrace.map{|l| "\t#{l}"}.join("\n")) rescue nil
|
36
|
-
raise e
|
37
|
-
ensure
|
38
|
-
Xml.logger.puts("Closing server");
|
39
|
-
server.close
|
40
|
-
end
|
41
|
-
end
|
42
|
-
@mutex.synchronize { @proceed.wait(@mutex) } if wait_for_start
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def daemonize!
|
48
|
-
pid = Process.fork
|
49
|
-
if pid
|
50
|
-
print pid
|
51
|
-
exit
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
module Debugger
|
2
|
-
module Xml
|
3
|
-
module Ide
|
4
|
-
|
5
|
-
class ControlCommandProcessor < Debugger::Processor
|
6
|
-
|
7
|
-
def initialize(interface)
|
8
|
-
@interface = interface
|
9
|
-
end
|
10
|
-
|
11
|
-
def process_commands
|
12
|
-
while input = @interface.read_command
|
13
|
-
process_input(input)
|
14
|
-
end
|
15
|
-
rescue IOError, Errno::EPIPE
|
16
|
-
rescue Exception
|
17
|
-
print "INTERNAL ERROR!!! #{$!}\n" rescue nil
|
18
|
-
print $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
|
19
|
-
ensure
|
20
|
-
@interface.close
|
21
|
-
end
|
22
|
-
|
23
|
-
def process_command(cmd)
|
24
|
-
catch(:debug_error) do
|
25
|
-
if matched_cmd = control_commands.find { |c| c.match(cmd) }
|
26
|
-
matched_cmd.execute
|
27
|
-
else
|
28
|
-
process_context_commands(cmd)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def control_commands
|
36
|
-
@control_commands = begin
|
37
|
-
control_command_classes = Command.commands.select(&:allow_in_control)
|
38
|
-
state = Debugger::ControlCommandProcessor::State.new(@interface, control_command_classes)
|
39
|
-
control_command_classes.map { |cmd| cmd.new(state) }
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def process_input(input)
|
44
|
-
split_commands(input).each do |cmd|
|
45
|
-
process_command(cmd)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def process_context_commands(input)
|
50
|
-
unless Debugger.handler.at_line?
|
51
|
-
errmsg pr("base.errors.no_suspended_thread", input: input)
|
52
|
-
return
|
53
|
-
end
|
54
|
-
event_command_classes = Command.commands.select(&:event)
|
55
|
-
state = Debugger::CommandProcessor::State.new do |s|
|
56
|
-
s.context = Debugger.handler.context
|
57
|
-
s.file = Debugger.handler.file
|
58
|
-
s.line = Debugger.handler.line
|
59
|
-
s.binding = Debugger.handler.context.frame_binding(0)
|
60
|
-
s.interface = @interface
|
61
|
-
s.commands = event_command_classes
|
62
|
-
end
|
63
|
-
event_commands = event_command_classes.map { |cls| cls.new(state) }
|
64
|
-
catch(:debug_error) do
|
65
|
-
if cmd = event_commands.find { |c| c.match(input) }
|
66
|
-
if state.context.dead? && cmd.class.need_context
|
67
|
-
print pr("base.errors.command_unavailable")
|
68
|
-
else
|
69
|
-
cmd.execute
|
70
|
-
end
|
71
|
-
else
|
72
|
-
print pr("base.errors.unknown_command", input: input)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
state.context.thread.run if state.proceed?
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|