OLD | NEW |
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 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 note = NOTES[ref] | 207 note = NOTES[ref] |
208 elif ref.endswith('_2eproto()'): | 208 elif ref.endswith('_2eproto()'): |
209 note = 'protocol compiler bug: crbug.com/105626' | 209 note = 'protocol compiler bug: crbug.com/105626' |
210 | 210 |
211 if note: | 211 if note: |
212 ref_output.append('%s [%s]' % (ref, note)) | 212 ref_output.append('%s [%s]' % (ref, note)) |
213 else: | 213 else: |
214 ref_output.append(ref) | 214 ref_output.append(ref) |
215 | 215 |
216 if opts.diffable: | 216 if opts.diffable: |
217 print '\n'.join('# ' + qualified_filename + ' ' + r for r in ref_output) | 217 if ref_output: |
| 218 print '\n'.join('# ' + qualified_filename + ' ' + r for r in ref_output) |
| 219 else: |
| 220 print '# %s: (empty initializer list)' % qualified_filename |
218 else: | 221 else: |
219 print '%s (initializer offset 0x%x size 0x%x)' % (qualified_filename, | 222 print '%s (initializer offset 0x%x size 0x%x)' % (qualified_filename, |
220 addr, size) | 223 addr, size) |
221 print ''.join(' %s\n' % r for r in ref_output) | 224 print ''.join(' %s\n' % r for r in ref_output) |
222 | 225 |
223 if opts.diffable: | 226 if opts.diffable: |
224 print '#', | 227 print '#', |
225 print 'Found %d static initializers in %d files.' % (initializer_count, | 228 print 'Found %d static initializers in %d files.' % (initializer_count, |
226 file_count) | 229 file_count) |
227 | 230 |
228 return 0 | 231 return 0 |
229 | 232 |
230 if '__main__' == __name__: | 233 if '__main__' == __name__: |
231 sys.exit(main()) | 234 sys.exit(main()) |
OLD | NEW |