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

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

Issue 817653003: Update from https://crrev.com/309717 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 # contain other bundles. 61 # contain other bundles.
62 def chrome_dsym_hints(binary): 62 def chrome_dsym_hints(binary):
63 path_parts = binary.split(os.path.sep) 63 path_parts = binary.split(os.path.sep)
64 app_positions = [] 64 app_positions = []
65 framework_positions = [] 65 framework_positions = []
66 for index, part in enumerate(path_parts): 66 for index, part in enumerate(path_parts):
67 if part.endswith('.app'): 67 if part.endswith('.app'):
68 app_positions.append(index) 68 app_positions.append(index)
69 elif part.endswith('.framework'): 69 elif part.endswith('.framework'):
70 framework_positions.append(index) 70 framework_positions.append(index)
71 assert len(framework_positions) <= 1, \
72 "The path contains more than one framework: %s" % binary
73 bundle_positions = app_positions + framework_positions 71 bundle_positions = app_positions + framework_positions
74 bundle_positions.sort() 72 bundle_positions.sort()
75 assert len(bundle_positions) <= 2, \ 73 assert len(bundle_positions) <= 2, \
76 "The path contains more than two nested bundles: %s" % binary 74 "The path contains more than two nested bundles: %s" % binary
77 if len(bundle_positions) == 0: 75 if len(bundle_positions) == 0:
78 # Case 1: this is a standalone executable or dylib. 76 # Case 1: this is a standalone executable or dylib.
79 return [] 77 return []
80 assert (len(bundle_positions) == 1 or 78 assert (not (len(app_positions) == 1 and
81 len(app_positions) == 2 or 79 len(framework_positions) == 1 and
82 app_positions[0] < framework_positions[0]), \ 80 app_positions[0] > framework_positions[0])), \
83 "The path contains an app bundle inside a framework: %s" % binary 81 "The path contains an app bundle inside a framework: %s" % binary
84 # Cases 2 and 3. The outermost bundle (which is the only bundle in the case 2) 82 # Cases 2 and 3. The outermost bundle (which is the only bundle in the case 2)
85 # is located in the product dir. 83 # is located in the product dir.
86 outermost_bundle = bundle_positions[0] 84 outermost_bundle = bundle_positions[0]
87 product_dir = path_parts[:outermost_bundle] 85 product_dir = path_parts[:outermost_bundle]
88 # In case 2 this is the same as |outermost_bundle|. 86 # In case 2 this is the same as |outermost_bundle|.
89 innermost_bundle = bundle_positions[-1] 87 innermost_bundle = bundle_positions[-1]
90 dsym_path = product_dir + [path_parts[innermost_bundle]] 88 dsym_path = product_dir + [path_parts[innermost_bundle]]
91 result = '%s.dSYM' % os.path.sep.join(dsym_path) 89 result = '%s.dSYM' % os.path.sep.join(dsym_path)
92 return [result] 90 return [result]
93 91
94 92
95 def main(): 93 def main():
96 disable_buffering() 94 disable_buffering()
97 set_symbolizer_path() 95 set_symbolizer_path()
98 asan_symbolize.demangle = True 96 asan_symbolize.demangle = True
99 asan_symbolize.fix_filename_patterns = sys.argv[1:] 97 asan_symbolize.fix_filename_patterns = sys.argv[1:]
100 asan_symbolize.logfile = sys.stdin 98 asan_symbolize.logfile = sys.stdin
101 loop = asan_symbolize.SymbolizationLoop(dsym_hint_producer=chrome_dsym_hints) 99 loop = asan_symbolize.SymbolizationLoop(dsym_hint_producer=chrome_dsym_hints)
102 loop.process_logfile() 100 loop.process_logfile()
103 101
104 if __name__ == '__main__': 102 if __name__ == '__main__':
105 main() 103 main()
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/tests/traceimpl.txt ('k') | tools/valgrind/asan/third_party/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698