11320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci# Copyright (c) 2014 The Chromium Authors. All rights reserved. 203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)# Use of this source code is governed by a BSD-style license that can be 303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)# found in the LICENSE file. 403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)import chromium_deps 61320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccifrom common import utils 703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)import crash_utils 803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)import findit_for_crash as findit 903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)import stacktrace 1003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 1103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 1203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)def SplitStacktrace(stacktrace_string): 1303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) """Preprocesses stacktrace string into two parts, release and debug. 1403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 1503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) Args: 1603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) stacktrace_string: A string representation of stacktrace, 1703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) in clusterfuzz format. 1803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 1903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) Returns: 2003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) A tuple of list of strings, release build stacktrace and 2103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) debug build stacktrace. 2203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) """ 2303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # Make sure we only parse release/debug build stacktrace, and ignore 2403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # unsymbolised stacktrace. 2503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) in_release_or_debug_stacktrace = False 2603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) release_build_stacktrace_lines = None 2703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) debug_build_stacktrace_lines = None 2803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) current_stacktrace_lines = [] 2903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 3003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # Iterate through all lines in stacktrace. 3103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) for line in stacktrace_string.splitlines(): 3203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) line = line.strip() 3303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 3403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # If the line starts with +, it signifies the start of new stacktrace. 351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if line.startswith('+-') and line.endswith('-+'): 3603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if 'Release Build Stacktrace' in line: 3703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) in_release_or_debug_stacktrace = True 3803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) current_stacktrace_lines = [] 3903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) release_build_stacktrace_lines = current_stacktrace_lines 4003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 4103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) elif 'Debug Build Stacktrace' in line: 4203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) in_release_or_debug_stacktrace = True 4303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) current_stacktrace_lines = [] 4403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) debug_build_stacktrace_lines = current_stacktrace_lines 4503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 4603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # If the stacktrace is neither release/debug build stacktrace, ignore 4703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # all lines after it until we encounter release/debug build stacktrace. 4803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) else: 4903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) in_release_or_debug_stacktrace = False 5003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 5103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # This case, it must be that the line is an actual stack frame, so add to 5203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # the current stacktrace. 5303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) elif in_release_or_debug_stacktrace: 5403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) current_stacktrace_lines.append(line) 5503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 5603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return (release_build_stacktrace_lines, debug_build_stacktrace_lines) 5703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 5803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 5903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)def FindCulpritCLs(stacktrace_string, 6003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) build_type, 6103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) chrome_regression=None, 6203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) component_regression=None, 6303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) chrome_crash_revision=None, 6403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) component_crash_revision=None, 651320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci crashing_component_path=None, 661320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci crashing_component_name=None, 671320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci crashing_component_repo_url=None): 6803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) """Returns the result, a list of result.Result objects and message. 6903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 701320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci If either or both of component_regression and component_crash_revision is not 711320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci None, is is assumed that crashing_component_path and 721320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci crashing_component_repo_url are not None. 731320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 7403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) Args: 7503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) stacktrace_string: A string representing stacktrace. 7603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) build_type: The type of the job. 7703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) chrome_regression: A string, chrome regression from clusterfuzz, in format 7803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) '123456:123457' 7903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) component_regression: A string, component regression in the same format. 8003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) chrome_crash_revision: A crash revision of chrome, in string. 8103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) component_crash_revision: A crash revision of the component, 8203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if component build. 831320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci crashing_component_path: A relative path of the crashing component, as in 841320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci DEPS file. For example, it would be 'src/v8' for 851320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci v8 and 'src/third_party/WebKit' for blink. 861320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci crashing_component_name: A name of the crashing component, such as v8. 871320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci crashing_component_repo_url: The URL of the crashing component's repo, as 881320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci shown in DEPS file. For example, 891320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'https://chromium.googlesource.com/skia.git' 901320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci for skia. 9103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 9203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) Returns: 9303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) A list of result objects, along with the short description on where the 9403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) result is from. 9503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) """ 9603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) build_type = build_type.lower() 9703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) component_to_crash_revision_dict = {} 9803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) component_to_regression_dict = {} 9903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 10003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # If chrome regression is available, parse DEPS file. 10103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) chrome_regression = crash_utils.SplitRange(chrome_regression) 10203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if chrome_regression: 10303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) chrome_regression_start = chrome_regression[0] 10403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) chrome_regression_end = chrome_regression[1] 10503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 10603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # Do not parse regression information for crashes introduced before the 10703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # first archived build. 10803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if chrome_regression_start != '0': 10903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) component_to_regression_dict = chromium_deps.GetChromiumComponentRange( 11003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) chrome_regression_start, chrome_regression_end) 1111320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if not component_to_regression_dict: 1121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return (('Failed to get component regression ranges for chromium ' 1131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'regression range %s:%s' 1141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci % (chrome_regression_start, chrome_regression_end)), []) 11503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 11603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # Parse crash revision. 11703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if chrome_crash_revision: 11803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) component_to_crash_revision_dict = chromium_deps.GetChromiumComponents( 11903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) chrome_crash_revision) 1201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if not component_to_crash_revision_dict: 1211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return (('Failed to get component dependencies for chromium revision "%s"' 1221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci % chrome_crash_revision), []) 1231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci # Check if component regression information is available. 1251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_regression = crash_utils.SplitRange(component_regression) 1261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if component_regression: 1271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_regression_start = component_regression[0] 1281320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_regression_end = component_regression[1] 1291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci # If this component already has an entry in parsed DEPS file, overwrite 1311320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci # regression range and url. 1321320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if crashing_component_path in component_to_regression_dict: 1331320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_regression_info = \ 1341320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_to_regression_dict[crashing_component_path] 1351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_regression_info['old_revision'] = component_regression_start 1361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_regression_info['new_revision'] = component_regression_end 1371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_regression_info['repository'] = crashing_component_repo_url 1381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci # if this component does not have an entry, add the entry to the parsed 1401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci # DEPS file. 1411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci else: 1421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci repository_type = crash_utils.GetRepositoryType( 1431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_regression_start) 1441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_regression_info = { 1451320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'path': crashing_component_path, 1461320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'rolled': True, 1471320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'name': crashing_component_name, 1481320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'old_revision': component_regression_start, 1491320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'new_revision': component_regression_end, 1501320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'repository': crashing_component_repo_url, 1511320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'repository_type': repository_type 1521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 1531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_to_regression_dict[crashing_component_path] = \ 1541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_regression_info 1551320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1561320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci # If component crash revision is available, add it to the parsed crash 1571320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci # revisions. 1581320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if component_crash_revision: 1591320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1601320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci # If this component has already a crash revision info, overwrite it. 1611320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if crashing_component_path in component_to_crash_revision_dict: 1621320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_crash_revision_info = \ 1631320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_to_crash_revision_dict[crashing_component_path] 1641320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_crash_revision_info['revision'] = component_crash_revision 1651320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_crash_revision_info['repository'] = crashing_component_repo_url 1661320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1671320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci # If not, add it to the parsed DEPS. 1681320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci else: 1691320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if utils.IsGitHash(component_crash_revision): 1701320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci repository_type = 'git' 1711320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci else: 1721320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci repository_type = 'svn' 1731320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_crash_revision_info = { 1741320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'path': crashing_component_path, 1751320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'name': crashing_component_name, 1761320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'repository': crashing_component_repo_url, 1771320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'repository_type': repository_type, 1781320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 'revision': component_crash_revision 1791320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 1801320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_to_crash_revision_dict[crashing_component_path] = \ 1811320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci component_crash_revision_info 18203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 18303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # Parsed DEPS is used to normalize the stacktrace. Since parsed regression 18403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # and parsed crash state essentially contain same information, use either. 18503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if component_to_regression_dict: 18603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) parsed_deps = component_to_regression_dict 18703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) elif component_to_crash_revision_dict: 18803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) parsed_deps = component_to_crash_revision_dict 18903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) else: 19003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return (('Identifying culprit CL requires at lease one of regression ' 19103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 'information or crash revision'), []) 19203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 19303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # Split stacktrace into release build/debug build and parse them. 19403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) (release_build_stacktrace, debug_build_stacktrace) = SplitStacktrace( 19503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) stacktrace_string) 1961320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if not (release_build_stacktrace or debug_build_stacktrace): 1971320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci parsed_release_build_stacktrace = stacktrace.Stacktrace( 1981320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci stacktrace_string.splitlines(), build_type, parsed_deps) 1991320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci else: 2001320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci parsed_release_build_stacktrace = stacktrace.Stacktrace( 2011320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci release_build_stacktrace, build_type, parsed_deps) 2021320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 20303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) parsed_debug_build_stacktrace = stacktrace.Stacktrace( 20403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) debug_build_stacktrace, build_type, parsed_deps) 20503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 20603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # Get a highest priority callstack (main_stack) from stacktrace, with release 20703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # build stacktrace in higher priority than debug build stacktace. This stack 20803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # is the callstack to find blame information for. 20903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) if parsed_release_build_stacktrace.stack_list: 21003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) main_stack = parsed_release_build_stacktrace.GetCrashStack() 21103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) elif parsed_debug_build_stacktrace.stack_list: 21203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) main_stack = parsed_debug_build_stacktrace.GetCrashStack() 21303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) else: 2141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci if 'mac_' in build_type: 2151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return ('No line information available in stacktrace.', []) 2161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 2171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return ('Findit failed to find any stack trace. Is it in a new format?', []) 21803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 21903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) # Run the algorithm on the parsed stacktrace, and return the result. 22003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) stacktrace_list = [parsed_release_build_stacktrace, 22103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) parsed_debug_build_stacktrace] 22203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) return findit.FindItForCrash( 22303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) stacktrace_list, main_stack, component_to_regression_dict, 22403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) component_to_crash_revision_dict) 225