OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """ | 6 """ |
7 This script can take an Apple-style CrashReporter log and symbolicate it. This | 7 This script can take an Apple-style CrashReporter log and symbolicate it. This |
8 is useful for when a user's reports aren't being uploaded, for example. | 8 is useful for when a user's reports aren't being uploaded, for example. |
9 | 9 |
10 Only versions 6, 7, 8, and 9 reports are supported. For more information on the | 10 Only versions 6, 7, 8, and 9 reports are supported. For more information on the |
11 file format, reference this document: | 11 file format, reference this document: |
12 TN2123 <http://developer.apple.com/library/mac/#technotes/tn2004/tn2123.html> | 12 TN2123 <http://developer.apple.com/library/mac/#technotes/tn2004/tn2123.html> |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 frame.offset = matches.group(5) | 176 frame.offset = matches.group(5) |
177 frame.line = None | 177 frame.line = None |
178 return frame | 178 return frame |
179 | 179 |
180 def _ParseSpindumpStack(self, fd): | 180 def _ParseSpindumpStack(self, fd): |
181 """Parses a spindump stack report. In this format, each thread stack has | 181 """Parses a spindump stack report. In this format, each thread stack has |
182 both a user and kernel trace. Only the user traces are symbolicated.""" | 182 both a user and kernel trace. Only the user traces are symbolicated.""" |
183 | 183 |
184 # The stack trace begins with the thread header, which is identified by a | 184 # The stack trace begins with the thread header, which is identified by a |
185 # HEX number. The thread names appear to be incorrect in spindumps. | 185 # HEX number. The thread names appear to be incorrect in spindumps. |
186 user_thread_re = re.compile('^ Thread ([0-9a-fx]+)') | 186 user_thread_re = re.compile('^ Thread ([0-9a-fx]{4})') |
187 | 187 |
188 # When this method is called, the fd has been walked right up to the first | 188 # When this method is called, the fd has been walked right up to the first |
189 # line. | 189 # line. |
190 line = fd.readline() | 190 line = fd.readline() |
191 in_user_stack = False | 191 in_user_stack = False |
192 in_kernel_stack = False | 192 in_kernel_stack = False |
193 thread = None | 193 thread = None |
194 frame_id = 0 | 194 frame_id = 0 |
195 while user_thread_re.match(line) or in_user_stack or in_kernel_stack: | 195 while user_thread_re.match(line) or in_user_stack or in_kernel_stack: |
196 # Check for the start of a thread. | 196 # Check for the start of a thread. |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 print >>sys.stderr, 'Using symbols from ' + symbol_path | 495 print >>sys.stderr, 'Using symbols from ' + symbol_path |
496 print >>sys.stderr, '=' * 80 | 496 print >>sys.stderr, '=' * 80 |
497 | 497 |
498 report.Symbolicate(symbol_path) | 498 report.Symbolicate(symbol_path) |
499 PrettyPrintReport(report) | 499 PrettyPrintReport(report) |
500 return 0 | 500 return 0 |
501 | 501 |
502 | 502 |
503 if __name__ == '__main__': | 503 if __name__ == '__main__': |
504 sys.exit(Main(sys.argv)) | 504 sys.exit(Main(sys.argv)) |
OLD | NEW |