Class: WebTools::Support::Debugger::Process
- Defined in:
- lib/web_tools/support/debugger.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#label ⇒ Object
Returns the value of attribute label.
-
#thread ⇒ Object
Returns the value of attribute thread.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#delete ⇒ Object
Kill process, remove entry from ObjectLog.
- #frames ⇒ Object
-
#initialize(thread) ⇒ Process
constructor
A new instance of Process.
-
#pop_exception_handling_frames ⇒ Object
Searches method frames included in ExceptionFrames from the top of the stack, and resets the stack to the last ruby frame before that.
- #ruby_frames ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(thread) ⇒ Process
Returns a new instance of Process.
78 79 80 81 82 |
# File 'lib/web_tools/support/debugger.rb', line 78 def initialize(thread) @label = thread.inspect @thread = thread @timestamp = Time.now end |
Instance Attribute Details
#exception ⇒ Object
Returns the value of attribute exception.
69 70 71 |
# File 'lib/web_tools/support/debugger.rb', line 69 def exception @exception end |
#label ⇒ Object
Returns the value of attribute label.
69 70 71 |
# File 'lib/web_tools/support/debugger.rb', line 69 def label @label end |
#thread ⇒ Object
Returns the value of attribute thread.
69 70 71 |
# File 'lib/web_tools/support/debugger.rb', line 69 def thread @thread end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
69 70 71 |
# File 'lib/web_tools/support/debugger.rb', line 69 def @timestamp end |
Class Method Details
.new(thread) ⇒ Object
71 72 73 74 75 76 |
# 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 |
Instance Method Details
#[](key) ⇒ Object
124 125 126 |
# File 'lib/web_tools/support/debugger.rb', line 124 def [](key) @thread[key] end |
#[]=(key, value) ⇒ Object
128 129 130 |
# File 'lib/web_tools/support/debugger.rb', line 128 def []=(key, value) @thread[key] = value end |
#delete ⇒ Object
Kill process, remove entry from ObjectLog
85 86 87 |
# File 'lib/web_tools/support/debugger.rb', line 85 def delete @thread.exit end |
#frames ⇒ Object
95 96 97 98 99 100 101 102 103 |
# 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 ⇒ Object
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.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# 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 ⇒ Object
89 90 91 92 93 |
# 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 ⇒ Object
132 133 134 135 136 |
# File 'lib/web_tools/support/debugger.rb', line 132 def to_hash { :label => label, :process_id => thread.object_id, :timestamp => } end |