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