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 | 7 |
| 8 def FilterFramesBeforeSignature(callstack, signature): | 8 def FilterFramesBeforeSignature(callstack, signature): |
| 9 """Filter all the stack frames before the signature frame. | 9 """Filters all the stack frames before the signature frame. |
| 10 | 10 |
| 11 Note: The callstack is filtered in place. | 11 Note: The callstack is filtered in place. |
| 12 """ | 12 """ |
| 13 if not signature: | 13 if not signature: |
| 14 return | 14 return |
| 15 | 15 |
| 16 signature_frame_index = 0 | 16 signature_frame_index = 0 |
| 17 # Filter out the types of signature, for example [Out of Memory]. | 17 # Filter out the types of signature, for example [Out of Memory]. |
| 18 signature = re.sub('[[][^]]*[]]\s*', '', signature) | 18 signature = re.sub('[[][^]]*[]]\s*', '', signature) |
| 19 | 19 |
| 20 for index, frame in enumerate(callstack): | 20 for index, frame in enumerate(callstack): |
| 21 if signature in frame.function: | 21 if signature in frame.function: |
| 22 signature_frame_index = index | 22 signature_frame_index = index |
| 23 | 23 |
| 24 print signature_frame_index | |
|
Martin Barbella
2016/05/10 06:00:41
Remove before landing.
Sharu Jiang
2016/05/12 23:58:00
Done.
| |
| 24 callstack[:] = callstack[signature_frame_index:] | 25 callstack[:] = callstack[signature_frame_index:] |
| OLD | NEW |