Class: Satyr::Thread
- Inherits:
-
Object
- Object
- Satyr::Thread
- Defined in:
- lib/satyr.rb
Overview
Thread in a stack trace containing individual stack frames
Instance Method Summary collapse
-
#duphash(opts = {}) ⇒ Object
- Duplication hash for the thread The method takes an option hash with following keys: -
:frames
- number of frames to use (default 0 means use all) -
:flags
- bitwise sum of (:normal, :nohash, :nonormalize, :koops_compat) -
:prefix
-
string to be prepended in front of the text before hashing.
- bitwise sum of (:normal, :nohash, :nonormalize, :koops_compat) -
- number of frames to use (default 0 means use all) -
- Duplication hash for the thread The method takes an option hash with following keys: -
-
#initialize(pointer) ⇒ Thread
constructor
Private constructor - Thread objects are returned by Stacktrace methods.
Constructor Details
#initialize(pointer) ⇒ Thread
Private constructor - Thread objects are returned by Stacktrace methods
161 162 163 164 |
# File 'lib/satyr.rb', line 161 def initialize(pointer) raise SatyrError, "Invalid structure" if pointer.null? @struct = Satyr::FFI::ThreadStruct.new pointer end |
Instance Method Details
#duphash(opts = {}) ⇒ Object
Duplication hash for the thread The method takes an option hash with following keys:
:frames
-
number of frames to use (default 0 means use all)
:flags
-
bitwise sum of (:normal, :nohash, :nonormalize, :koops_compat)
:prefix
-
string to be prepended in front of the text before hashing
173 174 175 176 177 178 179 180 181 |
# File 'lib/satyr.rb', line 173 def duphash(opts = {}) opts = {:frames => 0, :flags => :normal, :prefix => ""}.merge(opts) str_pointer = Satyr::FFI.sr_thread_get_duphash @struct.to_ptr, opts[:frames], opts[:prefix], opts[:flags] raise SatyrError, "Failed to compute duphash" if str_pointer.null? hash = str_pointer.read_string Satyr::set_encoding hash Satyr::FFI.free str_pointer hash end |