Class: Satyr::Stacktrace

Inherits:
Object
  • Object
show all
Defined in:
lib/satyr.rb

Overview

Program stack trace, possibly composed of multiple threads

Instance Method Summary collapse

Constructor Details

#initialize(pointer) ⇒ Stacktrace

Private constructor - Stacktrace objects are created in Report#stacktrace

Raises:



139
140
141
142
# File 'lib/satyr.rb', line 139

def initialize(pointer)
  raise SatyrError, "Invalid structure" if pointer.null?
  @struct = Satyr::FFI::StacktraceStruct.new pointer
end

Instance Method Details

#find_crash_threadObject

Returns Thread that likely caused the crash that produced this stack trace

Raises:



147
148
149
150
151
152
153
154
# File 'lib/satyr.rb', line 147

def find_crash_thread
  pointer = Satyr::FFI.sr_stacktrace_find_crash_thread @struct.to_ptr
  raise SatyrError, "Could not find crash thread" if pointer.null?
  dup = Satyr::FFI.sr_thread_dup(pointer)
  raise SatyrError, "Failed to duplicate thread" if dup.null?

  Thread.send(:new, dup)
end