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

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

Issue 1950123003: [Findit] Fetch DEPS from buildspec/ instead of trunk for chrome official builds. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Update doc string. 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_crash_pipeline.py ('k') | appengine/findit/crash/results.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 FilterFramesBeforeSignature
8 from crash.stacktrace import Stacktrace 9 from crash.stacktrace import Stacktrace
9 from crash.stacktrace_parser import StacktraceParser 10 from crash.stacktrace_parser import StacktraceParser
10 from crash.type_enums import CallStackFormatType 11 from crash.type_enums import CallStackFormatType
11 12
12 13
13 FRACAS_CALLSTACK_START_PATTERN = re.compile(r'CRASHED \[(.*) @ 0x(.*)\]') 14 FRACAS_CALLSTACK_START_PATTERN = re.compile(r'CRASHED \[(.*) @ 0x(.*)\]')
14 15
15 16
16 _INFINITY_PRIORITY = 1000 17 _INFINITY_PRIORITY = 1000
17 18
18 19
19 class FracasParser(StacktraceParser): 20 class FracasParser(StacktraceParser):
20 21
21 def Parse(self, stacktrace_string, deps): 22 def Parse(self, stacktrace_string, deps, signature=None):
22 """Parse fracas stacktrace string into Stacktrace instance.""" 23 """Parse fracas stacktrace string into Stacktrace instance."""
23 stacktrace = Stacktrace() 24 stacktrace = Stacktrace()
24 callstack = CallStack(_INFINITY_PRIORITY) 25 callstack = CallStack(_INFINITY_PRIORITY)
25 26
26 for line in stacktrace_string.splitlines(): 27 for line in stacktrace_string.splitlines():
27 is_new_callstack, stack_priority, format_type = ( 28 is_new_callstack, stack_priority, format_type = (
28 self._IsStartOfNewCallStack(line)) 29 self._IsStartOfNewCallStack(line))
29 30
30 if is_new_callstack: 31 if is_new_callstack:
31 # If the callstack is not the initial one or empty, add it 32 # If the callstack is not the initial one or empty, add it
32 # to stacktrace. 33 # to stacktrace.
33 if callstack.priority != _INFINITY_PRIORITY and callstack: 34 if callstack.priority != _INFINITY_PRIORITY and callstack:
34 stacktrace.append(callstack) 35 stacktrace.append(callstack)
35 36
36 callstack = CallStack(stack_priority, format_type) 37 callstack = CallStack(stack_priority, format_type)
37 else: 38 else:
38 callstack.ParseLine(line, deps) 39 callstack.ParseLine(line, deps)
39 40
40 if callstack.priority != _INFINITY_PRIORITY and callstack: 41 if callstack.priority != _INFINITY_PRIORITY and callstack:
41 stacktrace.append(callstack) 42 stacktrace.append(callstack)
42 43
44 # Filter all the frames before signature frame.
45 FilterFramesBeforeSignature(stacktrace.GetCrashStack(), signature)
43 return stacktrace 46 return stacktrace
44 47
45 def _IsStartOfNewCallStack(self, line): 48 def _IsStartOfNewCallStack(self, line):
46 """Determine whether a line is a start of a callstack or not. 49 """Determine whether a line is a start of a callstack or not.
47 Returns a tuple - (is_new_callstack, stack_priority, format_type). 50 Returns a tuple - (is_new_callstack, stack_priority, format_type).
48 """ 51 """
49 if FRACAS_CALLSTACK_START_PATTERN.match(line): 52 if FRACAS_CALLSTACK_START_PATTERN.match(line):
50 #Fracas only provide magic signature stack (crash stack). 53 #Fracas only provide magic signature stack (crash stack).
51 return True, 0, CallStackFormatType.DEFAULT 54 return True, 0, CallStackFormatType.DEFAULT
52 55
53 return False, None, None 56 return False, None, None
OLDNEW
« no previous file with comments | « appengine/findit/crash/fracas_crash_pipeline.py ('k') | appengine/findit/crash/results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698