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

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

Issue 886563002: Switch from nm to objdump for the cygprofile tools. (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 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 """Patch an orderfile. 6 """Patch an orderfile.
7 7
8 Starting with a list of symbols in a binary and an orderfile (ordered list of 8 Starting with a list of symbols in a binary and an orderfile (ordered list of
9 symbols), matches the symbols in the orderfile and augments each symbol with the 9 symbols), matches the symbols in the orderfile and augments each symbol with the
10 symbols residing at the same address (due to having identical code). 10 symbols residing at the same address (due to having identical code).
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 Returns: 52 Returns:
53 The same output as _GroupSymbolInfosFromBinary. 53 The same output as _GroupSymbolInfosFromBinary.
54 """ 54 """
55 # Map the addresses to symbols. 55 # Map the addresses to symbols.
56 offset_to_symbol_infos = collections.defaultdict(list) 56 offset_to_symbol_infos = collections.defaultdict(list)
57 name_to_symbol_infos = collections.defaultdict(list) 57 name_to_symbol_infos = collections.defaultdict(list)
58 for symbol in symbol_infos: 58 for symbol in symbol_infos:
59 symbol = symbol_extractor.SymbolInfo(name=_RemoveClone(symbol.name), 59 symbol = symbol_extractor.SymbolInfo(name=_RemoveClone(symbol.name),
60 offset=symbol.offset, 60 offset=symbol.offset,
61 size=symbol.size) 61 size=symbol.size,
62 section=symbol.section)
62 offset_to_symbol_infos[symbol.offset].append(symbol) 63 offset_to_symbol_infos[symbol.offset].append(symbol)
63 name_to_symbol_infos[symbol.name].append(symbol) 64 name_to_symbol_infos[symbol.name].append(symbol)
64 return (dict(offset_to_symbol_infos), dict(name_to_symbol_infos)) 65 return (dict(offset_to_symbol_infos), dict(name_to_symbol_infos))
65 66
66 67
67 def _GroupSymbolInfosFromBinary(binary_filename): 68 def _GroupSymbolInfosFromBinary(binary_filename):
68 """Group all the symbols from a binary by name and offset. 69 """Group all the symbols from a binary by name and offset.
69 70
70 Args: 71 Args:
71 binary_filename: path to the binary. 72 binary_filename: path to the binary.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 _PrintSymbolsWithPrefixes(expanded_symbols, sys.stdout) 217 _PrintSymbolsWithPrefixes(expanded_symbols, sys.stdout)
217 # The following is needed otherwise Gold only applies a partial sort. 218 # The following is needed otherwise Gold only applies a partial sort.
218 print '.text' # gets methods not in a section, such as assembly 219 print '.text' # gets methods not in a section, such as assembly
219 print '.text.*' # gets everything else 220 print '.text.*' # gets everything else
220 return 0 221 return 0
221 222
222 223
223 if __name__ == '__main__': 224 if __name__ == '__main__':
224 logging.basicConfig(level=logging.INFO) 225 logging.basicConfig(level=logging.INFO)
225 sys.exit(main(sys.argv)) 226 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | tools/cygprofile/patch_orderfile_unittest.py » ('j') | tools/cygprofile/patch_orderfile_unittest.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698