summaryrefslogtreecommitdiff
path: root/chromium/tools/linux/dump-static-initializers.py
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-12-10 16:19:40 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-12-10 16:01:50 +0000
commit51f6c2793adab2d864b3d2b360000ef8db1d3e92 (patch)
tree835b3b4446b012c75e80177cef9fbe6972cc7dbe /chromium/tools/linux/dump-static-initializers.py
parent6036726eb981b6c4b42047513b9d3f4ac865daac (diff)
downloadqtwebengine-chromium-51f6c2793adab2d864b3d2b360000ef8db1d3e92.tar.gz
BASELINE: Update Chromium to 71.0.3578.93
Change-Id: I6a32086c33670e1b033f8b10e6bf1fd4da1d105d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/tools/linux/dump-static-initializers.py')
-rwxr-xr-xchromium/tools/linux/dump-static-initializers.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/chromium/tools/linux/dump-static-initializers.py b/chromium/tools/linux/dump-static-initializers.py
index b71d0627482..e937d681012 100755
--- a/chromium/tools/linux/dump-static-initializers.py
+++ b/chromium/tools/linux/dump-static-initializers.py
@@ -38,8 +38,10 @@ NOTES = {
IS_GIT_WORKSPACE = (subprocess.Popen(
['git', 'rev-parse'], stderr=subprocess.PIPE).wait() == 0)
+
class Demangler(object):
"""A wrapper around c++filt to provide a function to demangle symbols."""
+
def __init__(self, toolchain):
self.cppfilt = subprocess.Popen([toolchain + 'c++filt'],
stdin=subprocess.PIPE,
@@ -50,6 +52,7 @@ class Demangler(object):
self.cppfilt.stdin.write(sym + '\n')
return self.cppfilt.stdout.readline().strip()
+
# Matches for example: "cert_logger.pb.cc", capturing "cert_logger".
protobuf_filename_re = re.compile(r'(.*)\.pb\.cc$')
def QualifyFilenameAsProto(filename):
@@ -72,6 +75,7 @@ def QualifyFilenameAsProto(filename):
candidate = line.strip()
return candidate
+
# Regex matching the substring of a symbol's demangled text representation most
# likely to appear in a source file.
# Example: "v8::internal::Builtins::InitBuiltinFunctionTable()" becomes
@@ -99,6 +103,7 @@ def QualifyFilename(filename, symbol):
candidate = line.strip()
return candidate
+
# Regex matching nm output for the symbols we're interested in.
# See test_ParseNmLine for examples.
nm_re = re.compile(r'(\S+) (\S+) t (?:_ZN12)?_GLOBAL__(?:sub_)?I_(.*)')
@@ -123,6 +128,7 @@ def test_ParseNmLine():
'_GLOBAL__sub_I_extension_specifics.pb.cc')
assert parse == ('extension_specifics.pb.cc', 40607408, 36), parse
+
# Just always run the test; it is fast enough.
test_ParseNmLine()
@@ -136,6 +142,7 @@ def ParseNm(toolchain, binary):
if parse:
yield parse
+
# Regex matching objdump output for the symbols we're interested in.
# Example line:
# 12354ab: (disassembly, including <FunctionReference>)
@@ -158,13 +165,14 @@ def ExtractSymbolReferences(toolchain, binary, start, end):
if ref.startswith('.LC') or ref.startswith('_DYNAMIC'):
# Ignore these, they are uninformative.
continue
- if ref.startswith('_GLOBAL__I_'):
+ if re.match('_GLOBAL__(?:sub_)?I_', ref):
# Probably a relative jump within this function.
continue
refs.add(ref)
return sorted(refs)
+
def main():
parser = optparse.OptionParser(usage='%prog [option] filename')
parser.add_option('-d', '--diffable', dest='diffable',
@@ -236,5 +244,6 @@ def main():
return 0
+
if '__main__' == __name__:
sys.exit(main())