OLD | NEW |
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 |
11 import json | 11 import json |
12 import os | 12 import os |
| 13 import platform |
13 import re | 14 import re |
14 import subprocess | 15 import subprocess |
15 import sys | 16 import sys |
16 | 17 |
17 class LineBuffered(object): | 18 class LineBuffered(object): |
18 """Disable buffering on a file object.""" | 19 """Disable buffering on a file object.""" |
19 def __init__(self, stream): | 20 def __init__(self, stream): |
20 self.stream = stream | 21 self.stream = stream |
21 | 22 |
22 def write(self, data): | 23 def write(self, data): |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 'of these substrings will be stripped. E.g.: "Release/../../".') | 241 'of these substrings will be stripped. E.g.: "Release/../../".') |
241 parser.add_argument('--executable-path', | 242 parser.add_argument('--executable-path', |
242 help='Path to program executable. Used on OSX swarming bots to locate ' | 243 help='Path to program executable. Used on OSX swarming bots to locate ' |
243 'dSYM bundles for associated frameworks and bundles.') | 244 'dSYM bundles for associated frameworks and bundles.') |
244 args = parser.parse_args() | 245 args = parser.parse_args() |
245 | 246 |
246 disable_buffering() | 247 disable_buffering() |
247 set_symbolizer_path() | 248 set_symbolizer_path() |
248 asan_symbolize.demangle = True | 249 asan_symbolize.demangle = True |
249 asan_symbolize.fix_filename_patterns = args.strip_path_prefix | 250 asan_symbolize.fix_filename_patterns = args.strip_path_prefix |
| 251 # Most source paths for Chromium binaries start with |
| 252 # /path/to/src/out/Release/../../ |
| 253 asan_symbolize.fix_filename_patterns.append('Release/../../') |
250 binary_name_filter = None | 254 binary_name_filter = None |
251 if os.uname()[0] == 'Darwin': | 255 if platform.uname()[0] == 'Darwin': |
252 binary_name_filter = make_chrome_osx_binary_name_filter( | 256 binary_name_filter = make_chrome_osx_binary_name_filter( |
253 chrome_product_dir_path(args.executable_path)) | 257 chrome_product_dir_path(args.executable_path)) |
254 loop = asan_symbolize.SymbolizationLoop( | 258 loop = asan_symbolize.SymbolizationLoop( |
255 binary_name_filter=binary_name_filter, | 259 binary_name_filter=binary_name_filter, |
256 dsym_hint_producer=chrome_dsym_hints) | 260 dsym_hint_producer=chrome_dsym_hints) |
257 | 261 |
258 if args.test_summary_json_file: | 262 if args.test_summary_json_file: |
259 symbolize_snippets_in_json(args.test_summary_json_file, loop) | 263 symbolize_snippets_in_json(args.test_summary_json_file, loop) |
260 else: | 264 else: |
261 # Process stdin. | 265 # Process stdin. |
262 asan_symbolize.logfile = sys.stdin | 266 asan_symbolize.logfile = sys.stdin |
263 loop.process_logfile() | 267 loop.process_logfile() |
264 | 268 |
265 if __name__ == '__main__': | 269 if __name__ == '__main__': |
266 main() | 270 main() |
OLD | NEW |