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

Side by Side Diff: tools/linux/dump-static-initializers.py

Issue 9325078: warning about use in sizes.py (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Dump functions called by static intializers in a Linux Release binary. 6 """Dump functions called by static intializers in a Linux Release binary.
7 7
8 Usage example: 8 Usage example:
9 tools/linux/dump-static-intializers.py out/Release/chrome 9 tools/linux/dump-static-intializers.py out/Release/chrome
10 10
11 A brief overview of static initialization: 11 A brief overview of static initialization:
12 1) the compiler writes out, per object file, a function that contains 12 1) the compiler writes out, per object file, a function that contains
13 the static intializers for that file. 13 the static intializers for that file.
14 2) the compiler also writes out a pointer to that function in a special 14 2) the compiler also writes out a pointer to that function in a special
15 section. 15 section.
16 3) at link time, the linker concatenates the function pointer sections 16 3) at link time, the linker concatenates the function pointer sections
17 into a single list of all initializers. 17 into a single list of all initializers.
18 4) at run time, on startup the binary runs all function pointers. 18 4) at run time, on startup the binary runs all function pointers.
19 19
20 The functions in (1) all have mangled names of the form 20 The functions in (1) all have mangled names of the form
21 _GLOBAL__I_foobar.cc 21 _GLOBAL__I_foobar.cc
22 using objdump, we can disassemble those functions and dump all symbols that 22 using objdump, we can disassemble those functions and dump all symbols that
23 they reference. 23 they reference.
24 """ 24 """
25 25
26 # IMPORTANT: The 'sizes' step on the buildbots runs this script and prints its
27 # output. If you change the output format of this script, make sure it doesn't
28 # match the format expected by the bots. See
29 # tools/build/scripts/master/log_parser/process_log.py
30
26 import optparse 31 import optparse
27 import re 32 import re
28 import subprocess 33 import subprocess
29 import sys 34 import sys
30 35
31 # A map of symbol => informative text about it. 36 # A map of symbol => informative text about it.
32 NOTES = { 37 NOTES = {
33 '__cxa_atexit@plt': 'registers a dtor to run at exit', 38 '__cxa_atexit@plt': 'registers a dtor to run at exit',
34 'std::__ioinit': '#includes <iostream>, use <ostream> instead', 39 'std::__ioinit': '#includes <iostream>, use <ostream> instead',
35 } 40 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 addr, size) 186 addr, size)
182 print '\n'.join(ref_output) + '\n' 187 print '\n'.join(ref_output) + '\n'
183 188
184 print 'Found %d static initializers in %d files.' % (initializer_count, 189 print 'Found %d static initializers in %d files.' % (initializer_count,
185 file_count) 190 file_count)
186 191
187 return 0 192 return 0
188 193
189 if '__main__' == __name__: 194 if '__main__' == __name__:
190 sys.exit(main()) 195 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698