Class: Debugger::IdeControlCommandProcessor

Inherits:
IdeCommandProcessor show all
Defined in:
lib/ruby-debug-ide/ide_processor.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from IdeCommandProcessor

#initialize, #print, #splitter

Constructor Details

This class inherits a constructor from Debugger::IdeCommandProcessor

Instance Method Details

#process_commandsObject



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/ruby-debug-ide/ide_processor.rb', line 75

def process_commands
  @printer.print_debug("Starting control thread")
  ctrl_cmd_classes = Command.commands.select{|cmd| cmd.control}
  state = ControlState.new(@interface)
  ctrl_cmds = ctrl_cmd_classes.map{|cmd| cmd.new(state, @printer)}
  while input = @interface.read_command
    # escape % since print_debug might use printf
    # sleep 0.3
    catch(:debug_error) do
      if cmd = ctrl_cmds.find{|c| c.match(input) }
        @printer.print_debug "Processing in control: #{input.gsub('%', '%%')}"
        cmd.execute
      else
        @interface.command_queue << input
      end
    end
  end
rescue ::Exception
  @printer.print_debug "INTERNAL ERROR!!! #{$!}\n" rescue nil
  @printer.print_error "INTERNAL ERROR!!! #{$!}\n" rescue nil
  @printer.print_error $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
ensure
  @interface.close
end