lib/ruby-debug.rb in ruby-debug-ide-0.1.9 vs lib/ruby-debug.rb in ruby-debug-ide-0.1.10
- old
+ new
@@ -7,40 +7,51 @@
require 'ruby-debug/processor'
require 'ruby-debug/event_processor'
module Debugger
+ class << self
+ # Prints to the stderr using printf(*args) if debug logging flag (-d) is on.
+ def print_debug(*args)
+ if Debugger.is_debug
+ $stderr.printf(*args)
+ $stderr.printf("\n")
+ $stderr.flush
+ end
+ end
+ end
+
class Context
def interrupt
self.stop_next = 1
end
private
- def processor
- Debugger.processor
+ def event_processor
+ Debugger.event_processor
end
def at_breakpoint(breakpoint)
- processor.at_breakpoint(self, breakpoint)
+ event_processor.at_breakpoint(self, breakpoint)
end
def at_catchpoint(excpt)
- processor.at_catchpoint(self, excpt)
+ event_processor.at_catchpoint(self, excpt)
end
def at_tracing(file, line)
- processor.at_tracing(self, file, line)
+ event_processor.at_tracing(self, file, line)
end
def at_line(file, line)
- processor.at_line(self, file, line)
+ event_processor.at_line(self, file, line)
end
end
class << self
- attr_accessor :processor, :is_debug
+ attr_accessor :event_processor, :is_debug
attr_reader :control_thread
#
# Interrupts the current thread
#
@@ -87,16 +98,16 @@
def start_control(host, port)
raise "Debugger is not started" unless started?
return if @control_thread
@control_thread = DebugThread.new do
+ Debugger.print_debug("Waiting for connection on '#{host}:#{port}'")
server = TCPServer.new(host, port)
while (session = server.accept)
begin
interface = RemoteInterface.new(session)
- @processor = EventProcessor.new(interface)
- processor = ControlCommandProcessor.new(interface)
- processor.process_commands
+ @event_processor = EventProcessor.new(interface)
+ ControlCommandProcessor.new(interface).process_commands
rescue StandardError, ScriptError => ex
puts ex
end
end
end