class WebTools::Support::Debugger::Frame

Attributes

block_nesting[R]
debug_info[R]
defining_class[R]
gsmethod[R]
index[R]
method_name[R]
thread[R]

Public Class Methods

new(params) click to toggle source
# File lib/web_tools/support/debugger.rb, line 162
def initialize(params)
  @gsmethod = params[:method]
  @thread = params[:thread]
  @index = params[:index]
  initialize_frame_info
end

Public Instance Methods

context_eval(str) click to toggle source
# File lib/web_tools/support/debugger.rb, line 188
def context_eval(str)
  context_object.instance_eval(str)
end
context_object() click to toggle source
# File lib/web_tools/support/debugger.rb, line 192
def context_object
  @context ||= Context.create_for(self,
                                  debug_info![:self],
                                  debug_info![:context])
end
debug_info!() click to toggle source
# File lib/web_tools/support/debugger.rb, line 215
def debug_info!
  @debug_info ||=
    begin
      ary = @thread.__gsi_debugger_detailed_report_at(@index)
      context = {}
      # First the named temps, matched to values
      ary[6].each_with_index {|name,idx| context[name] = ary[7][idx] }
      # Then the remaining scope values with temporary names
      ary[7][ary[6].size..-1].each_with_index {|v,i| context[:'t#{i}'] = v}
      context[:'(receiver)'] = ary[1]
      context[:'(class)'] = ary[1].class
      context[:'(self)'] = ary[2]
      { :gsMethod => ary[0],
      :receiver => ary[1],
      :self => ary[2],
      :method => ary[3],
      :stepOffset => ary[4],
      :stepPoints => ary[5],
      :source => ary[8],
      :context => context }
    end
end
delete() click to toggle source

Pop frame off the stack, effectively restarting it

# File lib/web_tools/support/debugger.rb, line 170
def delete
  @thread.__trim_stack_to_level(@index)
end
initialize_frame_info() click to toggle source
# File lib/web_tools/support/debugger.rb, line 198
def initialize_frame_info
  label = @gsmethod.__name
  @block_nesting = 0
  m = @gsmethod
  while label.nil?
    m = m.__home_method
    label = m.__name
    @block_nesting += 1
  end
  @defining_class = m.__in_class
  @class = @gsmethod.__in_class
  @method_name = label
  if @gsmethod.__source_location
    @source_location = @gsmethod.__source_location.join(":")
  end
end
step(symbol = :over) click to toggle source

Step. The manner of stepping defaults to :over, but :into or the number of steps can be passed as arguments

# File lib/web_tools/support/debugger.rb, line 176
def step(symbol = :over)
  raise RuntimeError, "can only step top frame" unless @index === 1
  case symbol
  when :into
    @thread.__step_over_in_frame(0)
  when :over
    @thread.__step_over_in_frame(1)
  when Fixnum
    @thread.__step_over_in_frame(arg)
  end
end
to_hash() click to toggle source
# File lib/web_tools/support/debugger.rb, line 238
def to_hash
  { :method_name => @method_name,
    :class => @class,
    :index => @index,
    :defining_class => @defining_class,
    :source_location => @source_location,
    :block_nesting => @block_nesting,
    :debug_info => @debug_info }
end