Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: appengine/findit/crash/fracas_parser.py

Issue 1914113002: [Findit] Enable project classifier and component classifier (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/findit/crash/fracas.py ('k') | appengine/findit/crash/project_classifier.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.callstack import CallStack 7 from crash.callstack import CallStack
8 from crash.callstack_filters import FilterInlineFunctionFrames 8 from crash.callstack_filters import FilterInlineFunctionFrames
9 from crash.stacktrace import Stacktrace 9 from crash.stacktrace import Stacktrace
10 from crash.stacktrace_parser import StacktraceParser 10 from crash.stacktrace_parser import StacktraceParser
11 from crash.type_enums import CallStackFormatType 11 from crash.type_enums import CallStackFormatType
12 12
13 13
14 FRACAS_CALLSTACK_START_PATTERN = re.compile(r'CRASHED \[(.*) @ 0x(.*)\]') 14 FRACAS_CALLSTACK_START_PATTERN = re.compile(r'CRASHED \[(.*) @ 0x(.*)\]')
15 15
16 16
17 _INFINITY_PRIORITY = 1000
18
19
20 class FracasParser(StacktraceParser): 17 class FracasParser(StacktraceParser):
21 18
22 def Parse(self, stacktrace_string, deps, signature=None): 19 def Parse(self, stacktrace_string, deps, signature=None):
23 """Parse fracas stacktrace string into Stacktrace instance.""" 20 """Parse fracas stacktrace string into Stacktrace instance."""
24 stacktrace = Stacktrace(signature=signature) 21 stacktrace = Stacktrace()
25 callstack = CallStack(_INFINITY_PRIORITY) 22 callstack = CallStack(float('inf'))
26 23
27 for line in stacktrace_string.splitlines(): 24 for line in stacktrace_string.splitlines():
28 is_new_callstack, stack_priority, format_type = ( 25 is_new_callstack, stack_priority, format_type = (
29 self._IsStartOfNewCallStack(line)) 26 self._IsStartOfNewCallStack(line))
30 27
31 if is_new_callstack: 28 if is_new_callstack:
32 # If the callstack is not the initial one or empty, add it 29 # If the callstack is not the initial one or empty, add it
33 # to stacktrace. 30 # to stacktrace.
34 if callstack.priority != _INFINITY_PRIORITY and callstack: 31 if callstack.priority != float('inf') and callstack:
35 stacktrace.append(callstack) 32 stacktrace.append(callstack)
36 33
37 callstack = CallStack(stack_priority, format_type) 34 callstack = CallStack(stack_priority, format_type)
38 else: 35 else:
39 callstack.ParseLine(line, deps) 36 callstack.ParseLine(line, deps)
40 37
41 if callstack.priority != _INFINITY_PRIORITY and callstack: 38 if callstack.priority != float('inf') and callstack:
42 stacktrace.append(callstack) 39 stacktrace.append(callstack)
43 40
44 # Filter all the frames before signature frame. 41 # Filter all the frames before signature frame.
45 if stacktrace: 42 if stacktrace:
46 stacktrace = Stacktrace(map(FilterInlineFunctionFrames, stacktrace)) 43 stacktrace = Stacktrace(map(FilterInlineFunctionFrames, stacktrace))
47 44
48 return stacktrace 45 return stacktrace
49 46
50 def _IsStartOfNewCallStack(self, line): 47 def _IsStartOfNewCallStack(self, line):
51 """Determine whether a line is a start of a callstack or not. 48 """Determine whether a line is a start of a callstack or not.
52 Returns a tuple - (is_new_callstack, stack_priority, format_type). 49 Returns a tuple - (is_new_callstack, stack_priority, format_type).
53 """ 50 """
54 if FRACAS_CALLSTACK_START_PATTERN.match(line): 51 if FRACAS_CALLSTACK_START_PATTERN.match(line):
55 #Fracas only provide magic signature stack (crash stack). 52 #Fracas only provide magic signature stack (crash stack).
56 return True, 0, CallStackFormatType.DEFAULT 53 return True, 0, CallStackFormatType.DEFAULT
57 54
58 return False, None, None 55 return False, None, None
OLDNEW
« no previous file with comments | « appengine/findit/crash/fracas.py ('k') | appengine/findit/crash/project_classifier.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698