| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from collections import namedtuple | 5 from collections import namedtuple |
| 6 import copy | 6 import copy |
| 7 import logging | 7 import logging |
| 8 import re | 8 import re |
| 9 | 9 |
| 10 from crash import parse_util | 10 from crash import parse_util |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 r'(.*?):(\d+)(:\d+)?$') | 21 r'(.*?):(\d+)(:\d+)?$') |
| 22 } | 22 } |
| 23 | 23 |
| 24 FRAME_INDEX_PATTERN = re.compile(r'\s*#(\d+)\s.*') | 24 FRAME_INDEX_PATTERN = re.compile(r'\s*#(\d+)\s.*') |
| 25 | 25 |
| 26 _DEFAULT_FORMAT_TYPE = CallStackFormatType.DEFAULT | 26 _DEFAULT_FORMAT_TYPE = CallStackFormatType.DEFAULT |
| 27 | 27 |
| 28 | 28 |
| 29 class StackFrame(namedtuple('StackFrame', | 29 class StackFrame(namedtuple('StackFrame', |
| 30 ['index', 'dep_path', 'function', 'file_path', 'raw_file_path', | 30 ['index', 'dep_path', 'function', 'file_path', 'raw_file_path', |
| 31 'crashed_line_numbers', 'repo_url'])): | 31 'crashed_line_numbers', 'repo_url'])): |
| 32 """Represents a frame in a stacktrace. | 32 """Represents a frame in a stacktrace. |
| 33 | 33 |
| 34 Attributes: | 34 Attributes: |
| 35 index (int): Index shown in the stacktrace if a stackframe line looks like | 35 index (int): Index shown in the stacktrace if a stackframe line looks like |
| 36 this - '#0 ...', else use the index in the callstack list. | 36 this - '#0 ...', else use the index in the callstack list. |
| 37 dep_path (str): Path of the dep this frame represents, for example, | 37 dep_path (str): Path of the dep this frame represents, for example, |
| 38 'src/', 'src/v8', 'src/skia'...etc. | 38 'src/', 'src/v8', 'src/skia'...etc. |
| 39 function (str): Function that caused the crash. | 39 function (str): Function that caused the crash. |
| 40 file_path (str): Normalized path of the crashed file, with parts dep_path | 40 file_path (str): Normalized path of the crashed file, with parts dep_path |
| 41 and parts before it stripped, for example, api.cc. | 41 and parts before it stripped, for example, api.cc. |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 for stack_buffer in self.stacks] | 369 for stack_buffer in self.stacks] |
| 370 | 370 |
| 371 if crash_stack_index is None: | 371 if crash_stack_index is None: |
| 372 # If there is no signature callstack, fall back to set crash stack using | 372 # If there is no signature callstack, fall back to set crash stack using |
| 373 # the first least priority callstack. | 373 # the first least priority callstack. |
| 374 crash_stack = min(callstacks, key=lambda stack: stack.priority) | 374 crash_stack = min(callstacks, key=lambda stack: stack.priority) |
| 375 else: | 375 else: |
| 376 crash_stack = callstacks[crash_stack_index] | 376 crash_stack = callstacks[crash_stack_index] |
| 377 | 377 |
| 378 return Stacktrace(tuple(callstacks), crash_stack) | 378 return Stacktrace(tuple(callstacks), crash_stack) |
| OLD | NEW |