class Byebug::Context


at_breakpoint, at_catchpoint, at_tracing, at_line and at_return callbacks
communication point between the library and the C-extension through the
Mantains context information for the debugger and it’s the main

def at_breakpoint(breakpoint)


Breakpoint handler
def at_breakpoint(breakpoint)
  processor.at_breakpoint(breakpoint)
end

def at_catchpoint(exception)


Catchpoint handler
def at_catchpoint(exception)
  processor.at_catchpoint(exception)
end

def at_end


End of class definition handler
def at_end
  return if ignored_file?(file)
  processor.at_end
end

def at_line


Line handler
def at_line
  self.frame = 0
  return if ignored_file?(file)
  processor.at_line
end

def at_return(return_value)


Return handler
def at_return(return_value)
  return if ignored_file?(file)
  processor.at_return(return_value)
end

def at_tracing


Tracing handler
def at_tracing
  return if ignored_file?(file)
  processor.at_tracing
end

def frame


Reader for the current frame
def frame
  @frame ||= Frame.new(self, 0)
end

def frame=(pos)


Writer for the current frame
def frame=(pos)
  @frame = Frame.new(self, pos)
end

def full_location


Current file, line and source code information
def full_location
  return location if virtual_file?(file)
  "#{location} #{get_line(file, line)}"
end

def ignored_file?(path)

Parameters:
  • path (String) -- filename to be checked.
def ignored_file?(path)
  self.class.ignored_files.include?(path)
end

def ignored_files


List of files byebug will ignore while debugging
def ignored_files
  @ignored_files ||=
    Byebug.mode == :standalone ? lib_files + [bin_file] : lib_files
end

def interface

def interface
  @interface ||= LocalInterface.new
end

def interrupt

def interrupt
  step_into 1
end

def location


Current file & line information
def location
  "#{normalize(file)}:#{line}"
end

def processor

def processor
  @processor ||= CommandProcessor
end

def processor

def processor
  @processor ||= self.class.processor.new(self, self.class.interface)
end

def stack_size


Context's stack size
def stack_size
  return 0 unless backtrace
  backtrace.drop_while { |l| ignored_file?(l.first.path) }
           .take_while { |l| !ignored_file?(l.first.path) }
           .size
end