summaryrefslogtreecommitdiff
path: root/chromium/tools/mac/dump-static-initializers.py
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-05-09 14:22:11 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-05-09 15:11:45 +0000
commit2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c (patch)
treee75f511546c5fd1a173e87c1f9fb11d7ac8d1af3 /chromium/tools/mac/dump-static-initializers.py
parenta4f3d46271c57e8155ba912df46a05559d14726e (diff)
downloadqtwebengine-chromium-2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c.tar.gz
BASELINE: Update Chromium to 51.0.2704.41
Also adds in all smaller components by reversing logic for exclusion. Change-Id: Ibf90b506e7da088ea2f65dcf23f2b0992c504422 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'chromium/tools/mac/dump-static-initializers.py')
-rwxr-xr-xchromium/tools/mac/dump-static-initializers.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/chromium/tools/mac/dump-static-initializers.py b/chromium/tools/mac/dump-static-initializers.py
new file mode 100755
index 00000000000..3a2c125062d
--- /dev/null
+++ b/chromium/tools/mac/dump-static-initializers.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Dumps a list of files with static initializers. Use with release builds.
+
+Usage:
+ tools/mac/dump-static-initializers.py out/Release/Chromium\ Framework.framework.dSYM/Contents/Resources/DWARF/Chromium\ Framework
+
+Do NOT use mac_strip_release=0 or component=shared_library if you want to use
+this script.
+"""
+
+import optparse
+import re
+import subprocess
+import sys
+
+# Matches for example:
+# [ 1] 000001ca 64 (N_SO ) 00 0000 0000000000000000 'test.cc'
+dsymutil_file_re = re.compile("N_SO.*'([^']*)'")
+
+# Matches for example:
+# [ 2] 000001d2 66 (N_OSO ) 00 0001 000000004ed856a0 '/Volumes/MacintoshHD2/src/chrome-git/src/test.o'
+dsymutil_o_file_re = re.compile("N_OSO.*'([^']*)'")
+
+# Matches for example:
+# [ 8] 00000233 24 (N_FUN ) 01 0000 0000000000001b40 '__GLOBAL__I_s'
+# [185989] 00dc69ef 26 (N_STSYM ) 02 0000 00000000022e2290 '__GLOBAL__I_a'
+dsymutil_re = re.compile(r"(?:N_FUN|N_STSYM).*\s[0-9a-f]*\s'__GLOBAL__I_")
+
+def ParseDsymutil(binary):
+ """Given a binary, prints source and object filenames for files with
+ static initializers.
+ """
+
+ child = subprocess.Popen(['dsymutil', '-s', binary], stdout=subprocess.PIPE)
+ for line in child.stdout:
+ file_match = dsymutil_file_re.search(line)
+ if file_match:
+ current_filename = file_match.group(1)
+ else:
+ o_file_match = dsymutil_o_file_re.search(line)
+ if o_file_match:
+ current_o_filename = o_file_match.group(1)
+ else:
+ match = dsymutil_re.search(line)
+ if match:
+ print current_filename
+ print current_o_filename
+ print
+
+
+def main():
+ parser = optparse.OptionParser(usage='%prog filename')
+ opts, args = parser.parse_args()
+ if len(args) != 1:
+ parser.error('missing filename argument')
+ return 1
+ binary = args[0]
+
+ ParseDsymutil(binary)
+ return 0
+
+
+if '__main__' == __name__:
+ sys.exit(main())