| OLD | NEW |
| (Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import re |
| 6 |
| 7 |
| 8 def FilterFramesBeforeSignature(callstack, signature): |
| 9 """Filter all the stack frames before the signature frame. |
| 10 |
| 11 Note: The callstack is filtered in place. |
| 12 """ |
| 13 if not signature: |
| 14 return |
| 15 |
| 16 signature_frame_index = 0 |
| 17 # Filter out the types of signature, for example [Out of Memory]. |
| 18 signature = re.sub('[[][^]]*[]]\s*', '', signature) |
| 19 |
| 20 for index, frame in enumerate(callstack): |
| 21 if signature in frame.function: |
| 22 signature_frame_index = index |
| 23 |
| 24 callstack[:] = callstack[signature_frame_index:] |
| OLD | NEW |