class Thread

Public Instance Methods

__basetype() click to toggle source
# File lib/mdbe/database_views/thread.rb, line 2
def __basetype
  :thread
end
__exception() click to toggle source
# File lib/mdbe/database_views/thread.rb, line 34
def __exception
  self[:last_exception]
end
__set_exception(exception) click to toggle source
# File lib/mdbe/database_views/thread.rb, line 30
def __set_exception(exception)
  self[:last_exception] = exception
end
__source_offset_for(frame, level) click to toggle source
# File lib/mdbe/database_views/thread.rb, line 47
def __source_offset_for(frame, level)
  # (frame at: 1) _sourceOffsetsAt: ((frame at: 1) _previousStepPointForIp: (frame at: 2))
  method = frame[0]
  method.__source_offsets_at(method.__step_point_for_ip(frame[1], level, __is_native_stack))
end
__source_with_break_for(frame) click to toggle source
# File lib/mdbe/database_views/thread.rb, line 53
def __source_with_break_for(frame)
  # (frame at: 1) _sourceOffsetsAt: ((frame at: 1) _previousStepPointForIp: (frame at: 2))
  method = frame[0]
  method.__source_at_ip(frame[1])
end
__stack_frame(index) click to toggle source
# File lib/mdbe/database_views/thread.rb, line 73
def __stack_frame(index)
  frame = __local_frame_contents_at(index)

  arg_values = []
  (10..frame.size - 1).each do |idx|
    arg_values.push(frame[idx].to_database_view(1, {}, {}))
  end

  method = frame[0]
  source_offset = __source_offset_for(frame, index)
  source_string = method.__source_string

  # magic numbers copied from GsProcess
  # [GsNMethod, ipOffset, frameOffset, varContext (nil), saveProtectionMode, markerOrException, nil (not used), self, argAndTempNames, receiver, args and temps, source offset, x-y source offset...
  [GsNMethodProxy.for(method).__for_database_explorer, frame[1], frame[2], nil, frame[4], frame[5].to_database_view(1, {}, {}), nil, frame[7].to_database_view(1, {}, {}), frame[8], frame[9].to_database_view(1, {}, {}), arg_values, source_offset, __xy_position_in_string(source_string, source_offset), __source_with_break_for(frame)]
end
__stack_method_names() click to toggle source
# File lib/mdbe/database_views/thread.rb, line 90
def __stack_method_names
  methods = []

  (1..__local_stack_depth).each do |idx|
    method = __local_method_at(idx)
    methods.push(method.__description_for_stack) if method != nil  # TODO: why do we need to check for nil here?
  end

  methods
end
__step_over_at(frame) click to toggle source
# File lib/mdbe/database_views/thread.rb, line 38
def __step_over_at(frame)
  thread = Thread.start(self) do |debug_thread|
    Thread.pass
    debug_thread.__step_over_in_frame(frame)
  end

  sleep 0.1 unless thread.stop?
end
__xy_position_in_string(string, offset) click to toggle source
# File lib/mdbe/database_views/thread.rb, line 59
def __xy_position_in_string(string, offset)
  substr = string[0, offset]
  y = substr.count("\n")
  x = nil

  if substr[-1] == "\n"
    x = 0
  else
    x = substr.split("\n").last.size - 1
  end

  return [x, y]
end
to_database_view(depth, ranges = {}, params = {}) click to toggle source
Calls superclass method Object#to_database_view
# File lib/mdbe/database_views/thread.rb, line 6
def to_database_view(depth, ranges = {}, params = {})
  obj = super

  if depth > 0
    obj[:exception] = __exception.to_database_view(depth - 1, {}, {})
    obj[:threadLocalStorage] = __environment.to_database_view(1, {}, {})
    obj[:threadLocalStorageSize] = __environment ? __environment.size : -1
    obj[:isRailsThread] = self[:is_rails_thread] ? true : false
    obj[:status] = self.status.to_s
  end

  return obj
end