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

Unified Diff: tools/valgrind/asan/asan_symbolize.py

Issue 797253002: Update the upstream version of asan_symbolize.py to r222535, (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed debug printing Created 6 years 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 | « no previous file | tools/valgrind/asan/third_party/README.chromium » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/valgrind/asan/asan_symbolize.py
diff --git a/tools/valgrind/asan/asan_symbolize.py b/tools/valgrind/asan/asan_symbolize.py
index ba8d69859fdb290451c6d1d1f931520004e1f316..ed6cce51cc96bf9447b58aa84ce5ebc57b48e7a9 100755
--- a/tools/valgrind/asan/asan_symbolize.py
+++ b/tools/valgrind/asan/asan_symbolize.py
@@ -44,6 +44,40 @@ def set_symbolizer_path():
assert(os.path.isfile(symbolizer_path))
os.environ['LLVM_SYMBOLIZER_PATH'] = os.path.abspath(symbolizer_path)
+# Construct a path to the .dSYM bundle for the given binary.
+# There are three possible cases for binary location in Chromium:
+# 1. The binary is a standalone executable in the product dir, the debug info
+# is in "binary.dSYM" in the product dir.
+# 2. The binary is a standalone framework or .app bundle, the debug info is in
+# "Framework.framework.dSYM" or "App.app.dSYM" in the product dir.
+# 3. The binary is a framework or an .app bundle within another .app bundle
+# (e.g. Outer.app/Contents/Versions/1.2.3.4/Inner.app), and the debug info
+# is in Inner.app.dSYM in the product dir.
+# The first case is handled by llvm-symbolizer, so we only need to construct
+# .dSYM paths for .app bundles and frameworks.
+def chrome_dsym_hints(binary):
+ parts = binary.split(os.path.sep)
earthdok 2014/12/16 14:19:57 I'd prefer a more descriptive name.
Alexander Potapenko 2014/12/16 14:49:13 Changed to "path_parts"
+ app_positions = []
+ framework_positions = []
+ for part, index in zip(parts, range(len(parts))):
earthdok 2014/12/16 14:19:57 for index, part in enumerate(parts):
Alexander Potapenko 2014/12/16 14:49:13 Done.
+ if part.endswith('.app'):
+ app_positions.append(index)
+ elif part.endswith('.framework'):
+ framework_positions.append(index)
+ # TODO(glider): more assertions
earthdok 2014/12/16 14:19:57 Why not add more assertions now?
Alexander Potapenko 2014/12/16 14:49:13 Changed the second one, should be enough for now.
+ assert(len(framework_positions) < 2)
earthdok 2014/12/16 14:19:57 Please raise an exception, or at the very least as
Alexander Potapenko 2014/12/16 14:49:13 Done.
+ assert(len(app_positions) <= 2)
+ bundles = app_positions + framework_positions
+ bundles.sort()
+ if len(bundles) == 0:
+ return []
+ outer_bundle = bundles[0]
+ if len(bundles) > 1:
earthdok 2014/12/16 14:19:57 I don't understand what this part does.
Alexander Potapenko 2014/12/16 14:49:13 Added a comment.
+ parts[outer_bundle] = parts[bundles[-1]]
+ parts = parts[:outer_bundle + 1]
+ result = '%s.dSYM' % os.path.sep.join(parts)
+ return [result]
+
def main():
disable_buffering()
@@ -51,7 +85,7 @@ def main():
asan_symbolize.demangle = True
asan_symbolize.fix_filename_patterns = sys.argv[1:]
asan_symbolize.logfile = sys.stdin
- loop = asan_symbolize.SymbolizationLoop()
+ loop = asan_symbolize.SymbolizationLoop(dsym_hint_producer=chrome_dsym_hints)
loop.process_logfile()
if __name__ == '__main__':
« no previous file with comments | « no previous file | tools/valgrind/asan/third_party/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698