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

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

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 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
OLDNEW
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
11 import bisect 11 import bisect
12 import getopt 12 import getopt
13 import os 13 import os
14 import re 14 import re
15 import subprocess 15 import subprocess
16 import sys 16 import sys
17 17
18 symbolizers = {} 18 symbolizers = {}
19 DEBUG = False 19 DEBUG = False
20 demangle = False 20 demangle = False
21 binutils_prefix = None 21 binutils_prefix = None
22 sysroot_path = None 22 sysroot_path = None
23 binary_name_filter = None 23 binary_name_filter = None
24 fix_filename_patterns = None 24 fix_filename_patterns = None
25 logfile = sys.stdin 25 logfile = sys.stdin
26 allow_system_symbolizer = True
26 27
27 # FIXME: merge the code that calls fix_filename(). 28 # FIXME: merge the code that calls fix_filename().
28 def fix_filename(file_name): 29 def fix_filename(file_name):
29 if fix_filename_patterns: 30 if fix_filename_patterns:
30 for path_to_cut in fix_filename_patterns: 31 for path_to_cut in fix_filename_patterns:
31 file_name = re.sub('.*' + path_to_cut, '', file_name) 32 file_name = re.sub('.*' + path_to_cut, '', file_name)
32 file_name = re.sub('.*asan_[a-z_]*.cc:[0-9]*', '_asan_rtl_', file_name) 33 file_name = re.sub('.*asan_[a-z_]*.cc:[0-9]*', '_asan_rtl_', file_name)
33 file_name = re.sub('.*crtstuff.c:0', '???:0', file_name) 34 file_name = re.sub('.*crtstuff.c:0', '???:0', file_name)
34 return file_name 35 return file_name
35 36
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 self.system, guess_arch(addr), self.dsym_hints) 386 self.system, guess_arch(addr), self.dsym_hints)
386 self.llvm_symbolizers[binary] = self.last_llvm_symbolizer 387 self.llvm_symbolizers[binary] = self.last_llvm_symbolizer
387 # Use the chain of symbolizers: 388 # Use the chain of symbolizers:
388 # Breakpad symbolizer -> LLVM symbolizer -> addr2line/atos 389 # Breakpad symbolizer -> LLVM symbolizer -> addr2line/atos
389 # (fall back to next symbolizer if the previous one fails). 390 # (fall back to next symbolizer if the previous one fails).
390 if not binary in symbolizers: 391 if not binary in symbolizers:
391 symbolizers[binary] = ChainSymbolizer( 392 symbolizers[binary] = ChainSymbolizer(
392 [BreakpadSymbolizerFactory(binary), self.llvm_symbolizers[binary]]) 393 [BreakpadSymbolizerFactory(binary), self.llvm_symbolizers[binary]])
393 result = symbolizers[binary].symbolize(addr, binary, offset) 394 result = symbolizers[binary].symbolize(addr, binary, offset)
394 if result is None: 395 if result is None:
396 if not allow_system_symbolizer:
397 raise Exception('Failed to launch or use llvm-symbolizer.')
395 # Initialize system symbolizer only if other symbolizers failed. 398 # Initialize system symbolizer only if other symbolizers failed.
396 symbolizers[binary].append_symbolizer( 399 symbolizers[binary].append_symbolizer(
397 SystemSymbolizerFactory(self.system, addr, binary)) 400 SystemSymbolizerFactory(self.system, addr, binary))
398 result = symbolizers[binary].symbolize(addr, binary, offset) 401 result = symbolizers[binary].symbolize(addr, binary, offset)
399 # The system symbolizer must produce some result. 402 # The system symbolizer must produce some result.
400 assert result 403 assert result
401 return result 404 return result
402 405
403 def get_symbolized_lines(self, symbolized_lines): 406 def get_symbolized_lines(self, symbolized_lines):
404 if not symbolized_lines: 407 if not symbolized_lines:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 binary_name_filter = sysroot_path_filter 473 binary_name_filter = sysroot_path_filter
471 sysroot_path = args.s 474 sysroot_path = args.s
472 if args.c: 475 if args.c:
473 binutils_prefix = args.c 476 binutils_prefix = args.c
474 if args.logfile: 477 if args.logfile:
475 logfile = args.logfile 478 logfile = args.logfile
476 else: 479 else:
477 logfile = sys.stdin 480 logfile = sys.stdin
478 loop = SymbolizationLoop(binary_name_filter) 481 loop = SymbolizationLoop(binary_name_filter)
479 loop.process_logfile() 482 loop.process_logfile()
OLDNEW
« no previous file with comments | « tools/valgrind/asan/third_party/README.chromium ('k') | tools/valgrind/drmemory/suppressions_full.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698