lib/byebug/dap.rb in byebug-dap-0.1.3 vs lib/byebug/dap.rb in byebug-dap-0.1.4
- old
+ new
@@ -3,10 +3,15 @@
require 'byebug/core'
require 'byebug/remote'
require_relative 'gem'
+module Byebug::DAP
+ # An alias for `ruby-dap`'s {DAP} module.
+ Protocol = ::DAP
+end
+
# load helpers
Dir[File.join(__dir__, 'dap', 'helpers', '*.rb')].each { |file| require file }
# load command base classes
require_relative 'dap/command'
@@ -20,12 +25,17 @@
require_relative 'dap/session'
require_relative 'dap/server'
module Byebug
class << self
- def start_dap(host, port = 0, &block)
- DAP::Server.new(&block).start(host, port)
+ # Creates and starts the server. See {DAP::Server#initialize} and
+ # {DAP::Server#start}.
+ # @param host the host passed to {DAP::Server#start}
+ # @param port the port passed to {DAP::Server#start}
+ # @return [DAP::Server]
+ def start_dap(host, port = 0)
+ DAP::Server.new.start(host, port)
end
end
class Context
public :processor
@@ -35,30 +45,33 @@
attr_reader :context
end
end
module Byebug::DAP
- Protocol = ::DAP
-
class << self
+ # (see Session.stop!)
+ def stop!
+ Session.stop!
+ end
+
+ # (see Session.child_spawned)
def child_spawned(*args)
Session.child_spawned(*args)
end
-
- def stop!
- interface = Byebug::Context.interface
- return false unless interface.is_a?(Session)
-
- interface.stop!
- true
- end
end
end
+# Debug logging
module Byebug::DAP::Debug
class << self
@protocol = false
@evaluate = false
- attr_accessor :protocol, :evaluate
+ # Log all sent and received protocol messages.
+ # @return [Boolean]
+ attr_accessor :protocol
+
+ # Log evaluation failures.
+ # @return [Boolean]
+ attr_accessor :evaluate
end
end