Class: Ruby::Reflection::ThreadMirror

Inherits:
ObjectMirror show all
Includes:
AbstractReflection::ThreadMirror, ShiftReset
Defined in:
lib/ruby/reflection/thread_mirror.rb

Direct Known Subclasses

Maglev::Reflection::ThreadMirror

Defined Under Namespace

Classes: Frame

Instance Attribute Summary

Attributes included from AbstractReflection::Mirror

#reflection

Instance Method Summary collapse

Methods included from ShiftReset

#reset, #shift

Methods included from AbstractReflection::ThreadMirror

#breakpoints, #compiler, #handle_exception, #kill, #reset, #shift, #step, #stop, #thread_data

Methods included from AbstractReflection::Mirror

#initialize, #mirrors?, #name, #reflectee

Methods included from AbstractReflection::Mirror::ClassMethods

#included, #mirror_class, #new, #reflect, #reflect!, #reflects?, #register_mirror

Methods inherited from ObjectMirror

#target_class, #variables

Methods included from AbstractReflection::ObjectMirror

#class_variables, #instance_eval, #objects_with_references, #path_to, #target_class, #transitive_closure, #variables

Instance Method Details

#return_valueObject



41
42
43
44
# File 'lib/ruby/reflection/thread_mirror.rb', line 41

def return_value
  return nil if @subject.alive?
  @subject.value
end

#runObject



23
24
25
# File 'lib/ruby/reflection/thread_mirror.rb', line 23

def run
  @subject.run
end

#stackObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ruby/reflection/thread_mirror.rb', line 27

def stack
  if bt = @subject.backtrace
    bt.each_with_index.collect do |str, idx|
      file, line, method_spec = str.split(':')
      method_spec =~ /\`([^']+)'/
      method = $1
      frame = Frame.new method, idx, file, line, self
      reflection.reflect frame
    end
  else
    []
  end
end

#statusObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/ruby/reflection/thread_mirror.rb', line 12

def status
  s = @subject.status
  if s.respond_to? :to_str
    s.to_str
  elsif s.nil?
    "aborted"
  else
    "dead"
  end
end