Files

Debugger::ControlCommandProcessor

A Debugger::ControlCommandProcessor is the kind of Debugger::Processor used the debugged program is running remotely. It is also entered after the debugged program has terminated.

Public Class Methods

new(interface) click to toggle source
# File cli/ruby-debug/processor.rb, line 464
def initialize(interface)
  super()
  @interface = interface
  @debugger_context_was_dead = true # Assume we haven't started.
end

Public Instance Methods

process_commands(verbose=false) click to toggle source

This the main debugger command-line loop. Here we read a debugger command, perform it, and ask for another one unless we are told to continue execution or terminate.

# File cli/ruby-debug/processor.rb, line 473
def process_commands(verbose=false)
  control_cmds = Command.commands.select do |cmd| 
    cmd.allow_in_control 
  end
  state = State.new(@interface, control_cmds)
  @commands = control_cmds.map{|cmd| cmd.new(state) }

  unless @debugger_context_was_dead
    if Debugger.annotate.to_i > 2
      aprint 'exited'  
      print "The program finished.\n" 
    end
    @debugger_context_was_dead = true
  end

  while input = @interface.read_command(prompt(nil))
    print "+#{input}" if verbose
    catch(:debug_error) do
      if cmd = @commands.find{|c| c.match(input) }
        cmd.execute
      else
        errmsg "Unknown command\n"
      end
    end
  end
rescue IOError, Errno::EPIPE
rescue Exception
  print "INTERNAL ERROR!!! #{$!}\n" rescue nil
  print $!.backtrace.map{|l| "\t#{l}"}.join("\n") rescue nil
ensure
  @interface.close
end
prompt(context) click to toggle source

Return a prompt string to show before reading a command. Note: The context parameter is not used. It must be provided so that the interface matches Debugger::CommandProcessor#prompt.

# File cli/ruby-debug/processor.rb, line 509
def prompt(context)
  p = '(rdb:ctrl) '
  p = afmt("pre-prompt")+p+"\n"+afmt("prompt") if 
    Debugger.annotate.to_i > 2
  return p
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.