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

Side by Side Diff: tools/cygprofile/symbol_extractor.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: Address nits. 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 """Utilities to get and manipulate symbols from a binary.""" 6 """Utilities to get and manipulate symbols from a binary."""
7 7
8 import collections 8 import collections
9 import os 9 import os
10 import re 10 import re
11 import subprocess 11 import subprocess
12 import sys 12 import sys
13 13
14 sys.path.insert( 14 sys.path.insert(
15 0, os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 15 0, os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
16 'third_party', 'android_platform', 'development', 16 'third_party', 'android_platform', 'development',
17 'scripts')) 17 'scripts'))
18 import symbol 18 import symbol
19 19
20
21 # TODO(lizeb): Change symbol.ARCH to the proper value when "arm" is no longer
22 # the only possible value.
23 _OBJDUMP_BINARY = symbol.ToolPath('objdump') 20 _OBJDUMP_BINARY = symbol.ToolPath('objdump')
24 21
25 22
26 SymbolInfo = collections.namedtuple('SymbolInfo', ('name', 'offset', 'size', 23 SymbolInfo = collections.namedtuple('SymbolInfo', ('name', 'offset', 'size',
27 'section')) 24 'section'))
28 25
26 def SetArchitecture(arch):
27 """Set the architecture for binaries to be symbolized."""
28 symbol.ARCH = arch
29 global _OBJDUMP_BINARY
pasko 2015/02/04 19:08:26 let's not increase global state. How about _GetObj
azarchs 2015/02/05 09:40:02 This isn't increasing global state - just changing
pasko 2015/02/05 10:24:50 Let's eliminate the _OBJDUMP_BINARY (referenced on
azarchs 2015/02/05 10:31:01 Done.
30 _OBJDUMP_BINARY = symbol.ToolPath('objdump')
31
29 32
30 def _FromObjdumpLine(line): 33 def _FromObjdumpLine(line):
31 """Create a SymbolInfo by parsing a properly formatted objdump output line. 34 """Create a SymbolInfo by parsing a properly formatted objdump output line.
32 35
33 Args: 36 Args:
34 line: line from objdump 37 line: line from objdump
35 38
36 Returns: 39 Returns:
37 An instance of SymbolInfo if the line represents a symbol, None otherwise. 40 An instance of SymbolInfo if the line represents a symbol, None otherwise.
38 """ 41 """
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 def CreateNameToSymbolInfo(symbol_infos): 114 def CreateNameToSymbolInfo(symbol_infos):
112 """Create a dict {name: symbol_info, ...}. 115 """Create a dict {name: symbol_info, ...}.
113 116
114 Args: 117 Args:
115 symbol_infos: iterable of SymbolInfo instances 118 symbol_infos: iterable of SymbolInfo instances
116 119
117 Returns: 120 Returns:
118 a dict {name: symbol_info, ...} 121 a dict {name: symbol_info, ...}
119 """ 122 """
120 return {symbol_info.name: symbol_info for symbol_info in symbol_infos} 123 return {symbol_info.name: symbol_info for symbol_info in symbol_infos}
OLDNEW
« tools/cygprofile/patch_orderfile.py ('K') | « tools/cygprofile/patch_orderfile.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698