Module: DebugAdapterProtocolTunnel
- Defined in:
- lib/debuggers.rb
Overview
Defined Under Namespace
Classes: DAPConnection
Constant Summary collapse
- @@dap_plugins =
nil- @@dap_debugger_option =
nil- @@dap_server =
nil- @@dap_connection =
nil
Class Method Summary collapse
- ._stop_remote_debugger ⇒ Object
- .dap_message_from_server(json) ⇒ Object
- .log_message_from_server(text) ⇒ Object
- .prepare(plugins, options) ⇒ Object
Class Method Details
._stop_remote_debugger ⇒ Object
150 151 152 153 154 155 156 157 158 |
# File 'lib/debuggers.rb', line 150 def self._stop_remote_debugger puts "DEBUGGER: Stopping remote debugger..." result = PluginTool.post("/api/development-plugin-loader/debugger-dap-stop") if result == 'OK' puts "DEBUGGER: Remote debugger stopped." else puts "DEBUGGER: Error stopping remote debugger, application server may be in non-functioning state." end end |
.dap_message_from_server(json) ⇒ Object
173 174 175 176 177 |
# File 'lib/debuggers.rb', line 173 def self.(json) if @@dap_connection @@dap_connection._write(JSON.parse(json)) end end |
.log_message_from_server(text) ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/debuggers.rb', line 160 def self.(text) if @@dap_connection @@dap_connection._write({ 'type' => 'event', 'event' => 'output', 'body' => { 'category' => 'console', 'output' => text+"\n" } }) end end |
.prepare(plugins, options) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/debuggers.rb', line 119 def self.prepare(plugins, ) @@dap_plugins = plugins @@dap_debugger_option = .debugger raise "BAD DEBUGGER OPTION #{@@dap_debugger_option}" unless @@dap_debugger_option =~ /\A(\d+)\z/ @@dap_server = TCPServer.new("127.0.0.1", @@dap_debugger_option.to_i) Thread.new do while true connection = @@dap_server.accept if connection if @@dap_connection connection.close else @@dap_connection = DAPConnection.new(connection, @@dap_plugins) Thread.new do @@dap_connection.run _stop_remote_debugger() @@dap_connection = nil end end end end rescue => e # ignore end at_exit do @@dap_server.close @@dap_connection.close if @@dap_connection _stop_remote_debugger() end end |