| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2017 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 class AtosRegexMatcher(object): |
| 9 def __init__(self): |
| 10 """ |
| 11 Atos output has two useful forms: |
| 12 1. <name> (in <library name>) (<filename>:<linenumber>) |
| 13 2. <name> (in <library name>) + <symbol offset> |
| 14 And two less useful forms: |
| 15 3. <address> |
| 16 4. <address> (in <library name>) |
| 17 e.g. |
| 18 1. -[SKTGraphicView drawRect:] (in Sketch) (SKTGraphicView.m:445) |
| 19 2. malloc (in libsystem_malloc.dylib) + 42 |
| 20 3. 0x4a12 |
| 21 4. 0x00000d9a (in Chromium) |
| 22 |
| 23 We don't bother checking for the latter two, and just return the full |
| 24 output. |
| 25 """ |
| 26 self._regex1 = re.compile(r"(.*) \(in (.+)\) \((.+):(\d+)\)") |
| 27 self._regex2 = re.compile(r"(.*) \(in (.+)\) \+ (\d+)") |
| 28 |
| 29 def Match(self, text): |
| 30 result = self._regex1.match(text) |
| 31 if result: |
| 32 return result.group(1) |
| 33 result = self._regex2.match(text) |
| 34 if result: |
| 35 return result.group(1) |
| 36 return text |
| OLD | NEW |