class Byebug::CommandProcessor
@see PostMortemProcessor for a example
example, whitelists only certain commands to be executed.
You can override this class to create your own command processor that, for
Processes commands in regular mode.
def after_repl
def after_repl interface.autosave end
def at_breakpoint(brkpt)
def at_breakpoint(brkpt) number = Byebug.breakpoints.index(brkpt) + 1 puts "Stopped by breakpoint #{number} at #{frame.file}:#{frame.line}" end
def at_catchpoint(exception)
def at_catchpoint(exception) puts "Catchpoint at #{context.location}: `#{exception}'" end
def at_line
def at_line process_commands end
def at_return
def at_return process_commands end
def at_tracing
def at_tracing puts "Tracing: #{context.full_location}" run_auto_commands(2) end
def auto_commands_for(run_level)
def auto_commands_for(run_level) command_list.select { |cmd| cmd.always_run >= run_level } end
def before_repl
def before_repl @proceed = false @prev_line = nil run_auto_commands(1) interface.autorestore end
def command_list
Available commands
def command_list @command_list ||= CommandList.new(commands) end
def commands
def commands Byebug.commands end
def frame
def frame @context.frame end
def initialize(context)
def initialize(context) @context = context @proceed = false @prev_line = nil end
def interface
def interface @interface ||= context.class.interface end
def printer
def printer @printer ||= Printers::Plain.new end
def proceed!
Let the execution continue
def proceed! @proceed = true end
def process_commands
Handle byebug commands.
def process_commands before_repl repl ensure after_repl end
def prompt
Prompt shown before reading a command.
def prompt '(byebug) ' end
def repl
Main byebug's REPL
def repl until @proceed cmd = interface.read_command(prompt) return if cmd.nil? next if cmd == '' run_cmd(cmd) end end
def run_auto_commands(run_level)
Run permanent commands.
def run_auto_commands(run_level) auto_commands_for(run_level).each { |cmd| cmd.new(self).execute } end
def run_cmd(input)
command is not found, it evaluates the unknown input.
Instantiates a command matching the input and runs it. If a matching
Executes the received input
def run_cmd(input) command = command_list.match(input) return command.new(self, input).execute if command puts thread_safe_eval(input) rescue => e errmsg(e) end