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

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

Issue 2742693004: Fix --dsym-hint passed to llvm analyzer
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | 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 argparse 9 import argparse
10 import base64 10 import base64
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return new_binary_path 116 return new_binary_path
117 return binary_path 117 return binary_path
118 return chrome_osx_binary_name_filter 118 return chrome_osx_binary_name_filter
119 119
120 120
121 # Construct a path to the .dSYM bundle for the given binary. 121 # Construct a path to the .dSYM bundle for the given binary.
122 # There are three possible cases for binary location in Chromium: 122 # There are three possible cases for binary location in Chromium:
123 # 1. The binary is a standalone executable or dynamic library in the product 123 # 1. The binary is a standalone executable or dynamic library in the product
124 # dir, the debug info is in "binary.dSYM" in the product dir. 124 # dir, the debug info is in "binary.dSYM" in the product dir.
125 # 2. The binary is a standalone framework or .app bundle, the debug info is in 125 # 2. The binary is a standalone framework or .app bundle, the debug info is in
126 # "Framework.framework.dSYM" or "App.app.dSYM" in the product dir. 126 # "Framework.dSYM" or "App.dSYM" in the product dir.
127 # 3. The binary is a framework or an .app bundle within another .app bundle 127 # 3. The binary is a framework or an .app bundle within another .app bundle
128 # (e.g. Outer.app/Contents/Versions/1.2.3.4/Inner.app), and the debug info 128 # (e.g. Outer.app/Contents/Versions/1.2.3.4/Inner.app), and the debug info
129 # is in Inner.app.dSYM in the product dir. 129 # is in Inner.app.dSYM in the product dir.
130 # The first case is handled by llvm-symbolizer, so we only need to construct 130 # The first case is handled by llvm-symbolizer, so we only need to construct
131 # .dSYM paths for .app bundles and frameworks. 131 # .dSYM paths for .app bundles and frameworks.
132 # We're assuming that there're no more than two nested bundles in the binary 132 # We're assuming that there're no more than two nested bundles in the binary
133 # path. Only one of these bundles may be a framework and frameworks cannot 133 # path. Only one of these bundles may be a framework and frameworks cannot
134 # contain other bundles. 134 # contain other bundles.
135 def chrome_dsym_hints(binary): 135 def chrome_dsym_hints(binary):
136 path_parts = split_path(binary) 136 path_parts = split_path(binary)
(...skipping 15 matching lines...) Expand all
152 len(framework_positions) == 1 and 152 len(framework_positions) == 1 and
153 app_positions[0] > framework_positions[0])), \ 153 app_positions[0] > framework_positions[0])), \
154 "The path contains an app bundle inside a framework: %s" % binary 154 "The path contains an app bundle inside a framework: %s" % binary
155 # Cases 2 and 3. The outermost bundle (which is the only bundle in the case 2) 155 # Cases 2 and 3. The outermost bundle (which is the only bundle in the case 2)
156 # is located in the product dir. 156 # is located in the product dir.
157 outermost_bundle = bundle_positions[0] 157 outermost_bundle = bundle_positions[0]
158 product_dir = path_parts[:outermost_bundle] 158 product_dir = path_parts[:outermost_bundle]
159 # In case 2 this is the same as |outermost_bundle|. 159 # In case 2 this is the same as |outermost_bundle|.
160 innermost_bundle = bundle_positions[-1] 160 innermost_bundle = bundle_positions[-1]
161 dsym_path = product_dir + [path_parts[innermost_bundle]] 161 dsym_path = product_dir + [path_parts[innermost_bundle]]
162 result = '%s.dSYM' % os.path.join(*dsym_path) 162 result = '%s.dSYM' % os.path.splitext(os.path.join(*dsym_path))[0]
163 return [result] 163 return [result]
164 164
165 165
166 # We want our output to match base::EscapeJSONString(), which produces 166 # We want our output to match base::EscapeJSONString(), which produces
167 # doubly-escaped strings. The first escaping pass is handled by this class. The 167 # doubly-escaped strings. The first escaping pass is handled by this class. The
168 # second pass happens when JSON data is dumped to file. 168 # second pass happens when JSON data is dumped to file.
169 class StringEncoder(json.JSONEncoder): 169 class StringEncoder(json.JSONEncoder):
170 def __init__(self): 170 def __init__(self):
171 json.JSONEncoder.__init__(self) 171 json.JSONEncoder.__init__(self)
172 172
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 if args.test_summary_json_file: 263 if args.test_summary_json_file:
264 symbolize_snippets_in_json(args.test_summary_json_file, loop) 264 symbolize_snippets_in_json(args.test_summary_json_file, loop)
265 else: 265 else:
266 # Process stdin. 266 # Process stdin.
267 asan_symbolize.logfile = sys.stdin 267 asan_symbolize.logfile = sys.stdin
268 loop.process_logfile() 268 loop.process_logfile()
269 269
270 if __name__ == '__main__': 270 if __name__ == '__main__':
271 main() 271 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698