class WebTools::Support::Debugger::Process

Attributes

exception[RW]
label[RW]
thread[RW]
timestamp[RW]

Public Class Methods

new(thread) click to toggle source
Calls superclass method
# File lib/web_tools/support/debugger.rb, line 71
def self.new(thread)
  if thread.is_a? ObjectLogEntry
    return ObjectLogError.new(thread) unless self == ObjectLogError
  end
  super(thread)
end
new(thread) click to toggle source
# File lib/web_tools/support/debugger.rb, line 78
def initialize(thread)
  @label = thread.inspect
  @thread = thread
  @timestamp = Time.now
end

Public Instance Methods

[](key) click to toggle source
# File lib/web_tools/support/debugger.rb, line 124
def [](key)
  @thread[key]
end
[]=(key, value) click to toggle source
# File lib/web_tools/support/debugger.rb, line 128
def []=(key, value)
  @thread[key] = value
end
delete() click to toggle source

Kill process, remove entry from ObjectLog

# File lib/web_tools/support/debugger.rb, line 85
def delete
  @thread.exit
end
frames() click to toggle source
# File lib/web_tools/support/debugger.rb, line 95
def frames
  methods = []
  @thread.__stack_depth.times do |idx|
    methods << [@thread.__method_at(idx + 1), idx + 1]
  end
  methods.collect do |method, idx|
    Frame.new(:method => method, :index => idx, :thread => thread)
  end
end
pop_exception_handling_frames() click to toggle source

Searches method frames included in ExceptionFrames from the top of the stack, and resets the stack to the last ruby frame before that. If no useable frame is found, the stack is not modified.

# File lib/web_tools/support/debugger.rb, line 109
def pop_exception_handling_frames
  m = @thread.__method_at(i = 1)
  until ExceptionFrames.include?(m.__name) or i >= @thread.__stack_depth
    i += 1
    m = @thread.__method_at(i)
  end
  if i < @thread.__stack_depth
    until m.__env_id == RubyEnv or i >= @thread.__stack_depth
      i += 1
      m = @thread.__method_at(i)
    end
  end
  @thread.__trim_stack_to_level(i) unless i >= @thread.__stack_depth
end
ruby_frames() click to toggle source
# File lib/web_tools/support/debugger.rb, line 89
def ruby_frames
  frames.select do |frame|
    frame.gsmethod.__env_id == RubyEnv
  end
end
to_hash() click to toggle source
# File lib/web_tools/support/debugger.rb, line 132
def to_hash
  { :label => label,
    :process_id => thread.object_id,
    :timestamp => timestamp }
end