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

Side by Side Diff: tools/valgrind/asan/asan_symbolize.py

Issue 728233003: Reland https://codereview.chromium.org/292153006 with minor changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « chrome/chrome_exe.gypi ('k') | tools/valgrind/asan/third_party/asan_symbolize.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 from third_party import asan_symbolize 7 from third_party import asan_symbolize
8 8
9 import os 9 import os
10 import sys 10 import sys
(...skipping 27 matching lines...) Expand all
38 script_dir = os.path.dirname(os.path.abspath(__file__)) 38 script_dir = os.path.dirname(os.path.abspath(__file__))
39 # Assume this script resides three levels below src/ (i.e. 39 # Assume this script resides three levels below src/ (i.e.
40 # src/tools/valgrind/asan/). 40 # src/tools/valgrind/asan/).
41 src_root = os.path.join(script_dir, "..", "..", "..") 41 src_root = os.path.join(script_dir, "..", "..", "..")
42 symbolizer_path = os.path.join(src_root, 'third_party', 42 symbolizer_path = os.path.join(src_root, 'third_party',
43 'llvm-build', 'Release+Asserts', 'bin', 'llvm-symbolizer') 43 'llvm-build', 'Release+Asserts', 'bin', 'llvm-symbolizer')
44 assert(os.path.isfile(symbolizer_path)) 44 assert(os.path.isfile(symbolizer_path))
45 os.environ['LLVM_SYMBOLIZER_PATH'] = os.path.abspath(symbolizer_path) 45 os.environ['LLVM_SYMBOLIZER_PATH'] = os.path.abspath(symbolizer_path)
46 46
47 47
48 def split_path(path):
49 parts = []
50 while True:
51 path, tail = os.path.split(path)
52 if tail:
53 parts.insert(0, tail)
54 else:
55 parts.insert(0, path)
56 break
57 return parts
58
59 def chrome_dsym_hints(binary):
60 parts = split_path(binary)
61 app_pos = -1
62 framework_pos = -1
63 for index in range(len(parts)):
64 part = parts[index]
65 if app_pos == -1 and part.endswith('.app'):
66 app_pos = index
67 if framework_pos == -1 and part.endswith('.framework'):
68 framework_pos = index
69 if framework_pos < 0:
70 if app_pos < 0:
71 return []
72 else:
73 parts = parts[:app_pos + 1]
74 else:
75 if app_pos > 0:
76 assert(app_pos < framework_pos)
77 parts[app_pos] = parts[framework_pos]
78 parts = parts[:app_pos + 1]
79 else:
80 parts = parts[:framework_pos + 1]
81 result = '%s.dSYM' % reduce(os.path.join, parts)
82 return [result]
83
84
48 def main(): 85 def main():
49 disable_buffering() 86 disable_buffering()
50 set_symbolizer_path() 87 set_symbolizer_path()
51 asan_symbolize.demangle = True 88 asan_symbolize.demangle = True
52 asan_symbolize.fix_filename_patterns = sys.argv[1:] 89 asan_symbolize.fix_filename_patterns = sys.argv[1:]
53 asan_symbolize.logfile = sys.stdin 90 asan_symbolize.logfile = sys.stdin
54 loop = asan_symbolize.SymbolizationLoop() 91 loop = asan_symbolize.SymbolizationLoop(dsym_hint_producer=chrome_dsym_hints)
55 loop.process_logfile() 92 loop.process_logfile()
56 93
57 if __name__ == '__main__': 94 if __name__ == '__main__':
58 main() 95 main()
OLDNEW
« no previous file with comments | « chrome/chrome_exe.gypi ('k') | tools/valgrind/asan/third_party/asan_symbolize.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698