class Rubinius::Debugger::Frame

Attributes

location[R]
number[R]

Public Class Methods

new(debugger, number, loc) click to toggle source
# File lib/rubinius/debugger/frame.rb, line 3
def initialize(debugger, number, loc)
  @debugger = debugger
  @number = number
  @location = loc
end

Public Instance Methods

binding() click to toggle source
# File lib/rubinius/debugger/frame.rb, line 15
def binding
  @binding ||= Binding.setup(
                 @location.variables,
                 @location.method,
                 @location.lexical_scope)
end
describe() click to toggle source
# File lib/rubinius/debugger/frame.rb, line 42
def describe
  if method.required_args > 0
    locals = []
    0.upto(method.required_args-1) do |arg|
      locals << method.local_names[arg].to_s
    end

    arg_str = locals.join(", ")
  else
    arg_str = ""
  end

  loc = @location

  if loc.is_block
    if arg_str.empty?
      recv = "{ } in #{loc.describe_receiver}#{loc.name}"
    else
      recv = "{|#{arg_str}| } in #{loc.describe_receiver}#{loc.name}"
    end
  else
    if arg_str.empty?
      recv = loc.describe
    else
      recv = "#{loc.describe}(#{arg_str})"
    end
  end

  str = "#{recv} at #{loc.method.active_path}:#{loc.line} (#{loc.ip})"
  if @debugger.variables[:show_ip]
    str << " (+#{loc.ip})"
  end

  str
end
ip() click to toggle source
# File lib/rubinius/debugger/frame.rb, line 30
def ip
  @location.ip
end
line() click to toggle source
# File lib/rubinius/debugger/frame.rb, line 26
def line
  @location.line
end
local_variables() click to toggle source
# File lib/rubinius/debugger/frame.rb, line 38
def local_variables
  method.local_names
end
method() click to toggle source
# File lib/rubinius/debugger/frame.rb, line 22
def method
  @location.method
end
run(code) click to toggle source
# File lib/rubinius/debugger/frame.rb, line 11
def run(code)
  eval(code, binding)
end
variables() click to toggle source
# File lib/rubinius/debugger/frame.rb, line 34
def variables
  @location.variables
end