Files

Debugger::ScriptInterface

A ScriptInterface is used when we are reading debugger commands from a command-file rather than an interactive user. Command files appear in a users initialization script (e.g. .rdebugrc) and appear when running the debugger command source (Debugger::SourceCommand).

Attributes

command_queue[RW]
histfile[RW]
history_length[RW]
history_save[RW]
restart_file[RW]

Public Class Methods

new(file, out, verbose=false) click to toggle source
# File cli/ruby-debug/interface.rb, line 217
def initialize(file, out, verbose=false)
  super()
  @command_queue = []
  @file = file.respond_to?(:gets) ? file : open(file)
  @out = out
  @verbose = verbose
  @history_save = false
  @history_length = 256  # take gdb default
  @histfile = ''
end

Public Instance Methods

close() click to toggle source
# File cli/ruby-debug/interface.rb, line 256
def close
  @file.close
end
confirm(prompt) click to toggle source

confirm is called before performing a dangerous action. In running a debugger script, we don’t want to prompt, so we’ll pretend the user has unconditionally said “yes” and return String “y”.

# File cli/ruby-debug/interface.rb, line 248
def confirm(prompt)
  'y'
end
read_command(prompt) click to toggle source
# File cli/ruby-debug/interface.rb, line 228
def read_command(prompt)
  while result = @file.gets
    puts "# #{result}" if @verbose
    next if result =~ /^\s*#/
    next if result.strip.empty?
    break
  end
  raise IOError unless result
  result.chomp!
end
readline_support?() click to toggle source

Do we have ReadLine support? When running an debugger command script, we are not interactive so we just return false.

# File cli/ruby-debug/interface.rb, line 241
def readline_support?
  false
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.