Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 8 |
| 8 def FilterFramesBeforeSignature(callstack, signature): | |
| 9 """Filter all the stack frames before the signature frame. | |
| 10 | 9 |
| 11 Note: The callstack is filtered in place. | 10 _INLINE_FUNCTION_FILE_PATH_MARKERS = [ |
| 11 'third_party/llvm-build/Release+Asserts/include/c++/v1/', | |
| 12 'linux/debian_wheezy_amd64-sysroot/usr/include/c++/4.6/bits/', | |
| 13 'eglibc-3GlaMS/eglibc-2.19/sysdeps/unix/', | |
| 14 ] | |
| 15 | |
| 16 | |
| 17 def FilterInlineFunctionFrames(callstack): | |
| 18 """Filters all the stack frames with inline function file paths. | |
| 19 | |
| 20 File paths that generated in runtime are not the oringinal file paths. They | |
|
stgao
2016/05/17 00:30:34
This seems incorrect to me.
The file paths above
Sharu Jiang
2016/05/17 18:34:58
Changed to a safer description.
| |
| 21 should be filtered out. | |
| 12 """ | 22 """ |
| 13 if not signature: | 23 def _IsNonInlineFunctionFrame(frame): |
| 14 return | 24 for path_marker in _INLINE_FUNCTION_FILE_PATH_MARKERS: |
| 25 if path_marker in frame.file_path: | |
| 26 return False | |
| 15 | 27 |
| 16 signature_frame_index = 0 | 28 return True |
| 17 # Filter out the types of signature, for example [Out of Memory]. | |
| 18 signature = re.sub('[[][^]]*[]]\s*', '', signature) | |
| 19 | 29 |
| 20 for index, frame in enumerate(callstack): | 30 return CallStack(callstack.priority, callstack.format_type, |
| 21 if signature in frame.function: | 31 filter(_IsNonInlineFunctionFrame, callstack)) |
| 22 signature_frame_index = index | |
| 23 | |
| 24 callstack[:] = callstack[signature_frame_index:] | |
| OLD | NEW |