OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 #===- lib/asan/scripts/asan_symbolize.py -----------------------------------===# | 2 #===- lib/asan/scripts/asan_symbolize.py -----------------------------------===# |
3 # | 3 # |
4 # The LLVM Compiler Infrastructure | 4 # The LLVM Compiler Infrastructure |
5 # | 5 # |
6 # This file is distributed under the University of Illinois Open Source | 6 # This file is distributed under the University of Illinois Open Source |
7 # License. See LICENSE.TXT for details. | 7 # License. See LICENSE.TXT for details. |
8 # | 8 # |
9 #===------------------------------------------------------------------------===# | 9 #===------------------------------------------------------------------------===# |
10 import argparse | 10 import argparse |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 # On Darwin, if the dsym hint producer is present: | 359 # On Darwin, if the dsym hint producer is present: |
360 # 1. check whether we've seen this binary already; if so, | 360 # 1. check whether we've seen this binary already; if so, |
361 # use |llvm_symbolizers[binary]|, which has already loaded the debug | 361 # use |llvm_symbolizers[binary]|, which has already loaded the debug |
362 # info for this binary (might not be the case for | 362 # info for this binary (might not be the case for |
363 # |last_llvm_symbolizer|); | 363 # |last_llvm_symbolizer|); |
364 # 2. otherwise check if we've seen all the hints for this binary already; | 364 # 2. otherwise check if we've seen all the hints for this binary already; |
365 # if so, reuse |last_llvm_symbolizer| which has the full set of hints; | 365 # if so, reuse |last_llvm_symbolizer| which has the full set of hints; |
366 # 3. otherwise create a new symbolizer and pass all currently known | 366 # 3. otherwise create a new symbolizer and pass all currently known |
367 # .dSYM hints to it. | 367 # .dSYM hints to it. |
368 if not binary in self.llvm_symbolizers: | 368 if not binary in self.llvm_symbolizers: |
369 use_last_symbolizer = True | 369 use_new_symbolizer = True |
370 if self.system == 'Darwin' and self.dsym_hint_producer: | 370 if self.system == 'Darwin' and self.dsym_hint_producer: |
371 dsym_hints_for_binary = set(self.dsym_hint_producer(binary)) | 371 dsym_hints_for_binary = set(self.dsym_hint_producer(binary)) |
372 use_last_symbolizer = bool(dsym_hints_for_binary - self.dsym_hints) | 372 use_new_symbolizer = bool(dsym_hints_for_binary - self.dsym_hints) |
373 self.dsym_hints |= dsym_hints_for_binary | 373 self.dsym_hints |= dsym_hints_for_binary |
374 if self.last_llvm_symbolizer and use_last_symbolizer: | 374 if self.last_llvm_symbolizer and not use_new_symbolizer: |
375 self.llvm_symbolizers[binary] = self.last_llvm_symbolizer | 375 self.llvm_symbolizers[binary] = self.last_llvm_symbolizer |
376 else: | 376 else: |
377 self.last_llvm_symbolizer = LLVMSymbolizerFactory( | 377 self.last_llvm_symbolizer = LLVMSymbolizerFactory( |
378 self.system, guess_arch(addr), self.dsym_hints) | 378 self.system, guess_arch(addr), self.dsym_hints) |
379 self.llvm_symbolizers[binary] = self.last_llvm_symbolizer | 379 self.llvm_symbolizers[binary] = self.last_llvm_symbolizer |
380 # Use the chain of symbolizers: | 380 # Use the chain of symbolizers: |
381 # Breakpad symbolizer -> LLVM symbolizer -> addr2line/atos | 381 # Breakpad symbolizer -> LLVM symbolizer -> addr2line/atos |
382 # (fall back to next symbolizer if the previous one fails). | 382 # (fall back to next symbolizer if the previous one fails). |
383 if not binary in symbolizers: | 383 if not binary in symbolizers: |
384 symbolizers[binary] = ChainSymbolizer( | 384 symbolizers[binary] = ChainSymbolizer( |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 binary_name_filter = sysroot_path_filter | 460 binary_name_filter = sysroot_path_filter |
461 sysroot_path = args.s | 461 sysroot_path = args.s |
462 if args.c: | 462 if args.c: |
463 binutils_prefix = args.c | 463 binutils_prefix = args.c |
464 if args.logfile: | 464 if args.logfile: |
465 logfile = args.logfile | 465 logfile = args.logfile |
466 else: | 466 else: |
467 logfile = sys.stdin | 467 logfile = sys.stdin |
468 loop = SymbolizationLoop(binary_name_filter) | 468 loop = SymbolizationLoop(binary_name_filter) |
469 loop.process_logfile() | 469 loop.process_logfile() |
OLD | NEW |