parameters: (self, fd)
docstring: Parses a spindump stack report. In this format, each thread stack has
      both a user and kernel trace. Only the user traces are symbolicated.
docstring_summary: Parses a spindump stack report. In this format, each thread stack has
      both a user and kernel trace. Only the user traces are symbolicated.
docstring_tokens: Parses a spindump stack report . In this format each thread stack has both a user and kernel trace . Only the user traces are symbolicated .
function: def _ParseSpindumpStack(self, fd):
      """Parses a spindump stack report. In this format, each thread stack has
      both a user and kernel trace. Only the user traces are symbolicated."""
  
      # The stack trace begins with the thread header, which is identified by a
      # HEX number. The thread names appear to be incorrect in spindumps.
      user_thread_re = re.compile('^  Thread ([0-9a-fx]+)')
  
      # When this method is called, the fd has been walked right up to the first
      # line.
      line = fd.readline()
      in_user_stack = False
      in_kernel_stack = False
      thread = None
      frame_id = 0
      while user_thread_re.match(line) or in_user_stack or in_kernel_stack:
        # Check for the start of a thread.
        matches = user_thread_re.match(line)
  
        if not line.strip():
          # A blank line indicates the start of a new thread. The blank line comes
          # after the kernel stack before a new thread header.
          in_kernel_stack = False
        elif matches:
          # This is the start of a thread header. The next line is the heading for
          # the user stack, followed by the actual trace.
          thread = CrashThread(matches.group(1))
          frame_id = 0
          self.threads.append(thread)
          in_user_stack = True
          line = fd.readline()  # Read past the 'User stack:' header.
        elif line.startswith('  Kernel stack:'):
          # The kernel stack header comes immediately after the last frame (really
          # the top frame) in the user stack, without a blank line.
          in_user_stack = False
          in_kernel_stack = True
        elif in_user_stack:
          # If this is a line while in the user stack, parse it as a stack frame.
          thread.stack.append(self._ParseSpindumpStackFrame(line))
        # Loop with the next line.
        line = fd.readline()
  
      # When the loop exits, the file has been read through the 'Binary images:'
      # header. Seek backwards so that _ParseBinaryImages() does the right thing.
      fd.seek(-len(line), os.SEEK_CUR)
function_tokens: def _ParseSpindumpStack ( self , fd ) : # The stack trace begins with the thread header, which is identified by a # HEX number. The thread names appear to be incorrect in spindumps. user_thread_re = re . compile ( '^  Thread ([0-9a-fx]+)' ) # When this method is called, the fd has been walked right up to the first # line. line = fd . readline ( ) in_user_stack = False in_kernel_stack = False thread = None frame_id = 0 while user_thread_re . match ( line ) or in_user_stack or in_kernel_stack : # Check for the start of a thread. matches = user_thread_re . match ( line ) if not line . strip ( ) : # A blank line indicates the start of a new thread. The blank line comes # after the kernel stack before a new thread header. in_kernel_stack = False elif matches : # This is the start of a thread header. The next line is the heading for # the user stack, followed by the actual trace. thread = CrashThread ( matches . group ( 1 ) ) frame_id = 0 self . threads . append ( thread ) in_user_stack = True line = fd . readline ( ) # Read past the 'User stack:' header. elif line . startswith ( '  Kernel stack:' ) : # The kernel stack header comes immediately after the last frame (really # the top frame) in the user stack, without a blank line. in_user_stack = False in_kernel_stack = True elif in_user_stack : # If this is a line while in the user stack, parse it as a stack frame. thread . stack . append ( self . _ParseSpindumpStackFrame ( line ) ) # Loop with the next line. line = fd . readline ( ) # When the loop exits, the file has been read through the 'Binary images:' # header. Seek backwards so that _ParseBinaryImages() does the right thing. fd . seek ( - len ( line ) , os . SEEK_CUR )