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

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

Issue 2707603002: [Predator] Generate all changelogs in regression ranges instead of only matched changelogs (Closed)
Patch Set: . Created 3 years, 10 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/scorers/top_frame_index.py ('k') | appengine/findit/crash/suspect.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 from collections import namedtuple 5 from collections import namedtuple
6 import copy 6 import copy
7 import logging 7 import logging
8 import math 8 import math
9 import re 9 import re
10 10
11 from crash import parse_util 11 from crash import parse_util
12 from crash.type_enums import CallStackFormatType 12 from crash.type_enums import CallStackFormatType
13 from crash.type_enums import LanguageType 13 from crash.type_enums import LanguageType
14 14
15 # Used to parse a line into StackFrame of a Callstack. 15 # Used to parse a line into StackFrame of a Callstack.
16 CALLSTACK_FORMAT_TO_PATTERN = { 16 CALLSTACK_FORMAT_TO_PATTERN = {
17 CallStackFormatType.JAVA: re.compile( 17 CallStackFormatType.JAVA: re.compile(
18 r'at ([A-Za-z0-9$._<>]+)\(\w+(\.java)?:(\d+)\)'), 18 r'at ([A-Za-z0-9$._<>]+)\(\w+(\.java)?:(\d+)\)'),
19 CallStackFormatType.SYZYASAN: re.compile( 19 CallStackFormatType.SYZYASAN: re.compile(
20 r'(CF: )?(.*?)( \(FPO: .*\) )?( \(CONV: .*\) )?\[(.*) @ (\d+)\]'), 20 r'(CF: )?(.*?)( \(FPO: .*\) )?( \(CONV: .*\) )?\[(.*) @ (\d+)\]'),
21 CallStackFormatType.DEFAULT: re.compile( 21 CallStackFormatType.DEFAULT: re.compile(
22 r'(.*?):(\d+)(:\d+)?$') 22 r'(.*?):(\d+)(:\d+)?$')
23 } 23 }
24 24
25 FRAME_INDEX_PATTERN = re.compile(r'\s*#(\d+)\s.*') 25 FRAME_INDEX_PATTERN = re.compile(r'\s*#(\d+)\s.*')
26 26
27 _DEFAULT_FORMAT_TYPE = CallStackFormatType.DEFAULT 27 _DEFAULT_FORMAT_TYPE = CallStackFormatType.DEFAULT
28 28
29 29
30 # TODO(wrengr): it's not clear why the ``priority`` is stored at all,
31 # given that every use in this file discards it. ``Result.file_to_stack_infos``
32 # should just store pointers directly to the frames themselves rather
33 # than needing this intermediate object.
34 # TODO(http://crbug.com/644476): this class needs a better name.
35 class StackInfo(namedtuple('StackInfo', ['frame', 'priority'])):
36 """Pair of a frame and the ``priority`` of the ``CallStack`` it came from."""
37 __slots__ = ()
38
39 def __str__(self): # pragma: no cover
40 return ('%s(frame = %s, priority = %f)'
41 % (self.__class__.__name__, self.frame, self.priority))
42
43
30 class StackFrame(namedtuple('StackFrame', 44 class StackFrame(namedtuple('StackFrame',
31 ['index', 'dep_path', 'function', 'file_path', 'raw_file_path', 45 ['index', 'dep_path', 'function', 'file_path', 'raw_file_path',
32 'crashed_line_numbers', 'repo_url'])): 46 'crashed_line_numbers', 'repo_url'])):
33 """Represents a frame in a stacktrace. 47 """Represents a frame in a stacktrace.
34 48
35 Attributes: 49 Attributes:
36 index (int): Index shown in the stacktrace if a stackframe line 50 index (int): Index shown in the stacktrace if a stackframe line
37 looks like this - '#0 ...', else use the index in the callstack 51 looks like this - '#0 ...', else use the index in the callstack
38 list. 52 list.
39 dep_path (str): Path of the dep this frame represents, for example, 53 dep_path (str): Path of the dep this frame represents, for example,
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 for stack_buffer in self.stacks] 403 for stack_buffer in self.stacks]
390 404
391 if crash_stack_index is None: 405 if crash_stack_index is None:
392 # If there is no signature callstack, fall back to set crash stack using 406 # If there is no signature callstack, fall back to set crash stack using
393 # the first least priority callstack. 407 # the first least priority callstack.
394 crash_stack = min(callstacks, key=lambda stack: stack.priority) 408 crash_stack = min(callstacks, key=lambda stack: stack.priority)
395 else: 409 else:
396 crash_stack = callstacks[crash_stack_index] 410 crash_stack = callstacks[crash_stack_index]
397 411
398 return Stacktrace(tuple(callstacks), crash_stack) 412 return Stacktrace(tuple(callstacks), crash_stack)
OLDNEW
« no previous file with comments | « appengine/findit/crash/scorers/top_frame_index.py ('k') | appengine/findit/crash/suspect.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698