Chromium Code Reviews| Index: appengine/findit/crash/callstack_filters.py |
| diff --git a/appengine/findit/crash/callstack_filters.py b/appengine/findit/crash/callstack_filters.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f911d98bf4396e0de16705f90a3763a2079dd47e |
| --- /dev/null |
| +++ b/appengine/findit/crash/callstack_filters.py |
| @@ -0,0 +1,21 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import re |
| + |
| + |
| +def SignatureFilter(callstack, signature): |
| + """Filter all the stack frames before the signature frame.""" |
|
Martin Barbella
2016/05/06 22:50:54
This class name could be improved to better reflec
Sharu Jiang
2016/05/06 23:43:46
Change it to FilterFramesBeforeSignature.
|
| + if not signature: |
| + return |
| + |
| + signature_frame_index = 0 |
| + # Filter out the types of signature, for exampel [Out of Memery] signature. |
|
Martin Barbella
2016/05/06 22:50:55
Nit: example and Memory, also no need for the last
Sharu Jiang
2016/05/06 23:43:46
Done.
|
| + signature = re.sub('[[][^]]*[]]\s*', '', signature) |
| + |
| + for index, frame in enumerate(callstack): |
| + if signature in frame.function: |
| + signature_frame_index = index |
| + |
| + callstack[:] = callstack[signature_frame_index:] |
|
stgao
2016/05/06 23:15:11
How about returning a new list instead of updating
Sharu Jiang
2016/05/06 23:43:46
Can I keep it in-place? Since I want to do:
Filter
stgao
2016/05/07 00:02:53
If it can't be avoided, let's make the docstring c
|