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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/bin/symbolize_trace_atos_regex.py
diff --git a/tracing/bin/symbolize_trace_atos_regex.py b/tracing/bin/symbolize_trace_atos_regex.py
new file mode 100644
index 0000000000000000000000000000000000000000..65356c3efa3f5a629a86292c8cf7c4f611aba4ee
--- /dev/null
+++ b/tracing/bin/symbolize_trace_atos_regex.py
@@ -0,0 +1,36 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import re
+
+
+class AtosRegexMatcher(object):
+ def __init__(self):
+ """
+ Atos output has two useful forms:
+ 1. <name> (in <library name>) (<filename>:<linenumber>)
+ 2. <name> (in <library name>) + <symbol offset>
+ And two less useful forms:
+ 3. <address>
+ 4. <address> (in <library name>)
+ e.g.
+ 1. -[SKTGraphicView drawRect:] (in Sketch) (SKTGraphicView.m:445)
+ 2. malloc (in libsystem_malloc.dylib) + 42
+ 3. 0x4a12
+ 4. 0x00000d9a (in Chromium)
+
+ We don't bother checking for the latter two, and just return the full
+ output.
+ """
+ self._regex1 = re.compile(r"(.*) \(in (.+)\) \((.+):(\d+)\)")
+ self._regex2 = re.compile(r"(.*) \(in (.+)\) \+ (\d+)")
+
+ def Match(self, text):
+ result = self._regex1.match(text)
+ if result:
+ return result.group(1)
+ result = self._regex2.match(text)
+ if result:
+ return result.group(1)
+ return text
« 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