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

Side by Side Diff: tools/cygprofile/cyglog_to_orderfile.py

Issue 902633002: Fix a bunch of issues blocking 64-bit orderfile generation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/python 1 #!/usr/bin/python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Symbolizes a log file produced by cyprofile instrumentation. 6 """Symbolizes a log file produced by cyprofile instrumentation.
7 7
8 Given a log file and the binary being profiled, creates an orderfile. 8 Given a log file and the binary being profiled, creates an orderfile.
9 """ 9 """
10 10
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 except SymbolNotFoundException: 213 except SymbolNotFoundException:
214 symbol_not_found_warnings.Write( 214 symbol_not_found_warnings.Write(
215 'Did not find function in binary. offset: ' + hex(offset)) 215 'Did not find function in binary. offset: ' + hex(offset))
216 success = False 216 success = False
217 unknown_symbol_warnings.WriteEnd('no known section for symbol.') 217 unknown_symbol_warnings.WriteEnd('no known section for symbol.')
218 symbol_not_found_warnings.WriteEnd('symbol not found in the binary.') 218 symbol_not_found_warnings.WriteEnd('symbol not found in the binary.')
219 return success 219 return success
220 220
221 221
222 def main(): 222 def main():
223 if len(sys.argv) != 4: 223 parser = optparse.OptionParser()
224 parser.add_option('--target_arch', action='store', type='string',
Benoit L 2015/02/04 17:12:57 nit: maybe use "choice" here to limit the values t
azarchs 2015/02/04 17:49:54 Done.
225 dest='arch', default='arm',
226 help='The target architecture for libchrome.so')
227 options, argv = parser.parse_args(sys.argv)
228 if len(argv) != 4:
224 logging.error('Usage: cyglog_to_orderfile.py <merged_cyglog> ' 229 logging.error('Usage: cyglog_to_orderfile.py <merged_cyglog> '
225 '<library> <output_filename>') 230 '<library> <output_filename>')
226 return 1 231 return 1
227 (log_filename, lib_filename, output_filename) = sys.argv[1:] 232 (log_filename, lib_filename, output_filename) = argv[1:]
233 symbol_extractor.SetArchitecture(options.arch)
228 234
229 obj_dir = os.path.abspath(os.path.join( 235 obj_dir = os.path.abspath(os.path.join(
230 os.path.dirname(lib_filename), '../obj')) 236 os.path.dirname(lib_filename), '../obj'))
231 237
232 log_file_lines = map(string.rstrip, open(log_filename).readlines()) 238 log_file_lines = map(string.rstrip, open(log_filename).readlines())
233 offsets = _ParseLogLines(log_file_lines) 239 offsets = _ParseLogLines(log_file_lines)
234 _WarnAboutDuplicates(offsets) 240 _WarnAboutDuplicates(offsets)
235 241
236 offset_to_symbol_infos = _GroupLibrarySymbolInfosByOffset(lib_filename) 242 offset_to_symbol_infos = _GroupLibrarySymbolInfosByOffset(lib_filename)
237 symbol_to_section_map = _GetSymbolToSectionMapFromObjectFiles(obj_dir) 243 symbol_to_section_map = _GetSymbolToSectionMapFromObjectFiles(obj_dir)
(...skipping 15 matching lines...) Expand all
253 output_file.close() 259 output_file.close()
254 if temp_filename: 260 if temp_filename:
255 os.remove(temp_filename) 261 os.remove(temp_filename)
256 262
257 return 0 if success else 1 263 return 0 if success else 1
258 264
259 265
260 if __name__ == '__main__': 266 if __name__ == '__main__':
261 logging.basicConfig(level=logging.INFO) 267 logging.basicConfig(level=logging.INFO)
262 sys.exit(main()) 268 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/cygprofile/cygprofile_unittest.cc » ('j') | tools/cygprofile/cygprofile_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698