Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: tracing/bin/symbolize_trace_atos_regex.py

Issue 2605183002: Update symbolize_trace to work on macOS. (Closed)
Patch Set: Comments from dskiba. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tracing/bin/symbolize_trace ('k') | tracing/bin/symbolize_trace_atos_regex_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « tracing/bin/symbolize_trace ('k') | tracing/bin/symbolize_trace_atos_regex_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698