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

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

Issue 2607813002: [Predator] Make ``CallStackDetector`` return a namedtuple. (Closed)
Patch Set: Fix nit. Created 3 years, 11 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
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 math 5 import math
6 import re 6 import re
7 7
8 from crash import callstack_detectors 8 from crash import callstack_detectors
9 from crash import callstack_filters 9 from crash import callstack_filters
10 from crash.stacktrace import CallStackBuffer 10 from crash.stacktrace import CallStackBuffer
(...skipping 14 matching lines...) Expand all
25 # Filters to filter callstack buffers. 25 # Filters to filter callstack buffers.
26 filters = [callstack_filters.FilterInlineFunction(), 26 filters = [callstack_filters.FilterInlineFunction(),
27 callstack_filters.KeepTopNFrames(top_n_frames or 27 callstack_filters.KeepTopNFrames(top_n_frames or
28 DEFAULT_TOP_N_FRAMES)] 28 DEFAULT_TOP_N_FRAMES)]
29 stacktrace_buffer = StacktraceBuffer(signature=signature, filters=filters) 29 stacktrace_buffer = StacktraceBuffer(signature=signature, filters=filters)
30 30
31 stack_detector = callstack_detectors.ChromeCrashStackDetector() 31 stack_detector = callstack_detectors.ChromeCrashStackDetector()
32 # Initial background callstack which is not to be added into Stacktrace. 32 # Initial background callstack which is not to be added into Stacktrace.
33 stack_buffer = CallStackBuffer() 33 stack_buffer = CallStackBuffer()
34 for line in stacktrace_string.splitlines(): 34 for line in stacktrace_string.splitlines():
35 is_new_callstack, priority, format_type, language_type, metadata = ( 35 start_of_callstack = stack_detector(line)
36 stack_detector.IsStartOfNewCallStack(line))
37 36
38 if is_new_callstack: 37 if start_of_callstack:
39 stacktrace_buffer.AddFilteredStack(stack_buffer) 38 stacktrace_buffer.AddFilteredStack(stack_buffer)
40 stack_buffer = CallStackBuffer(priority=priority, 39 stack_buffer = CallStackBuffer(
41 format_type=format_type, 40 priority=start_of_callstack.priority,
42 language_type=language_type, 41 format_type=start_of_callstack.format_type,
43 metadata=metadata) 42 language_type=start_of_callstack.language_type,
43 metadata=start_of_callstack.metadata)
wrengr 2016/12/29 20:13:02 Since we're just passing all the parts through, wh
Sharu Jiang 2016/12/29 21:40:14 I think it would be more clear that the ``stack_de
44 else: 44 else:
45 frame = StackFrame.Parse(stack_buffer.language_type, 45 frame = StackFrame.Parse(stack_buffer.language_type,
46 stack_buffer.format_type, line, deps, 46 stack_buffer.format_type, line, deps,
47 len(stack_buffer.frames)) 47 len(stack_buffer.frames))
48 if frame is not None: 48 if frame is not None:
49 stack_buffer.frames.append(frame) 49 stack_buffer.frames.append(frame)
50 50
51 # Add the last stack to stacktrace. 51 # Add the last stack to stacktrace.
52 stacktrace_buffer.AddFilteredStack(stack_buffer) 52 stacktrace_buffer.AddFilteredStack(stack_buffer)
53 return stacktrace_buffer.ToStacktrace() 53 return stacktrace_buffer.ToStacktrace()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698