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 import re | 5 import re |
6 | 6 |
7 from crash import parse_util | 7 from crash import parse_util |
8 from crash.type_enums import CallStackFormatType | 8 from crash.type_enums import CallStackFormatType, CallStackLanguageType |
9 from crash.type_enums import CallStackLanguageType | |
10 | 9 |
11 # Used to parse a line into StackFrame of a Callstack. | 10 # Used to parse a line into StackFrame of a Callstack. |
12 CALLSTACK_FORMAT_TO_PATTERN = { | 11 CALLSTACK_FORMAT_TO_PATTERN = { |
13 CallStackFormatType.JAVA: re.compile( | 12 CallStackFormatType.JAVA: re.compile( |
14 r'at ([A-Za-z0-9$._<>]+)\(\w+(\.java)?:(\d+)\)'), | 13 r'at ([A-Za-z0-9$._<>]+)\(\w+(\.java)?:(\d+)\)'), |
15 CallStackFormatType.SYZYASAN: re.compile( | 14 CallStackFormatType.SYZYASAN: re.compile( |
16 r'(CF: )?(.*?)( \(FPO: .*\) )?( \(CONV: .*\) )?\[(.*) @ (\d+)\]'), | 15 r'(CF: )?(.*?)( \(FPO: .*\) )?( \(CONV: .*\) )?\[(.*) @ (\d+)\]'), |
17 CallStackFormatType.DEFAULT: re.compile( | 16 CallStackFormatType.DEFAULT: re.compile( |
18 r'(.*?):(\d+)(:\d+)?$') | 17 r'(.*?):(\d+)(:\d+)?$') |
19 } | 18 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 # If we have the common stack frame index pattern, then use it | 154 # If we have the common stack frame index pattern, then use it |
156 # since it is more reliable. | 155 # since it is more reliable. |
157 index_match = FRAME_INDEX_PATTERN.match(line) | 156 index_match = FRAME_INDEX_PATTERN.match(line) |
158 if index_match: | 157 if index_match: |
159 stack_frame_index = int(index_match.group(1)) | 158 stack_frame_index = int(index_match.group(1)) |
160 else: | 159 else: |
161 stack_frame_index = len(self) | 160 stack_frame_index = len(self) |
162 | 161 |
163 self.append(StackFrame(stack_frame_index, dep_path, function, file_path, | 162 self.append(StackFrame(stack_frame_index, dep_path, function, file_path, |
164 raw_file_path, crashed_line_numbers, repo_url)) | 163 raw_file_path, crashed_line_numbers, repo_url)) |
OLD | NEW |