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

Side by Side Diff: build/android/asan_symbolize.py

Issue 1315743004: [Android] Add a custom pylintrc for build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix appurify_sanitized import-errors Created 5 years, 3 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 | « build/android/adb_reverse_forwarder.py ('k') | build/android/avd.py » ('j') | 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 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 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 7
8 import collections 8 import collections
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 asan_libs += [os.path.relpath(os.path.join(src_dir, f)) 43 asan_libs += [os.path.relpath(os.path.join(src_dir, f))
44 for f in files 44 for f in files
45 if f.endswith('.so')] 45 if f.endswith('.so')]
46 return asan_libs 46 return asan_libs
47 47
48 48
49 def _TranslateLibPath(library, asan_libs): 49 def _TranslateLibPath(library, asan_libs):
50 for asan_lib in asan_libs: 50 for asan_lib in asan_libs:
51 if os.path.basename(library) == os.path.basename(asan_lib): 51 if os.path.basename(library) == os.path.basename(asan_lib):
52 return '/' + asan_lib 52 return '/' + asan_lib
53 # pylint: disable=no-member
53 return symbol.TranslateLibPath(library) 54 return symbol.TranslateLibPath(library)
54 55
55 56
56 def _Symbolize(asan_input): 57 def _Symbolize(asan_input):
57 asan_libs = _FindASanLibraries() 58 asan_libs = _FindASanLibraries()
58 libraries = collections.defaultdict(list) 59 libraries = collections.defaultdict(list)
59 asan_lines = [] 60 asan_lines = []
60 for asan_log_line in [a.rstrip() for a in asan_input]: 61 for asan_log_line in [a.rstrip() for a in asan_input]:
61 m = _ParseAsanLogLine(asan_log_line) 62 m = _ParseAsanLogLine(asan_log_line)
62 if m: 63 if m:
63 libraries[m['library']].append(m) 64 libraries[m['library']].append(m)
64 asan_lines.append({'raw_log': asan_log_line, 'parsed': m}) 65 asan_lines.append({'raw_log': asan_log_line, 'parsed': m})
65 66
66 all_symbols = collections.defaultdict(dict) 67 all_symbols = collections.defaultdict(dict)
67 for library, items in libraries.iteritems(): 68 for library, items in libraries.iteritems():
68 libname = _TranslateLibPath(library, asan_libs) 69 libname = _TranslateLibPath(library, asan_libs)
69 lib_relative_addrs = set([i['rel_address'] for i in items]) 70 lib_relative_addrs = set([i['rel_address'] for i in items])
71 # pylint: disable=no-member
70 info_dict = symbol.SymbolInformationForSet(libname, 72 info_dict = symbol.SymbolInformationForSet(libname,
71 lib_relative_addrs, 73 lib_relative_addrs,
72 True) 74 True)
73 if info_dict: 75 if info_dict:
74 all_symbols[library]['symbols'] = info_dict 76 all_symbols[library]['symbols'] = info_dict
75 77
76 for asan_log_line in asan_lines: 78 for asan_log_line in asan_lines:
77 m = asan_log_line['parsed'] 79 m = asan_log_line['parsed']
78 if not m: 80 if not m:
79 print asan_log_line['raw_log'] 81 print asan_log_line['raw_log']
(...skipping 14 matching lines...) Expand all
94 options, _ = parser.parse_args() 96 options, _ = parser.parse_args()
95 if options.logcat: 97 if options.logcat:
96 asan_input = file(options.logcat, 'r') 98 asan_input = file(options.logcat, 'r')
97 else: 99 else:
98 asan_input = sys.stdin 100 asan_input = sys.stdin
99 _Symbolize(asan_input.readlines()) 101 _Symbolize(asan_input.readlines())
100 102
101 103
102 if __name__ == "__main__": 104 if __name__ == "__main__":
103 sys.exit(main()) 105 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/adb_reverse_forwarder.py ('k') | build/android/avd.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698