| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2017 The Chromium Authors. All rights reserved. | 2 # Copyright 2017 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 """Tool for analyzing binary size of executables using nm or linker map files. | 6 """Tool for analyzing binary size of executables using nm or linker map files. |
| 7 | 7 |
| 8 Map files can be created by passing "-Map Foo.map" to the linker. If a map file | 8 Map files can be created by passing "-Map Foo.map" to the linker. If a map file |
| 9 is unavailable, this tool can also be pointed at an unstripped executable, but | 9 is unavailable, this tool can also be pointed at an unstripped executable, but |
| 10 the information does not seem to be as accurate in this case. | 10 the information does not seem to be as accurate in this case. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return '\n'.join([ | 108 return '\n'.join([ |
| 109 '*' * 80, | 109 '*' * 80, |
| 110 'Entering interactive Python shell. Here is some inspiration:', | 110 'Entering interactive Python shell. Here is some inspiration:', |
| 111 '', | 111 '', |
| 112 '# Show pydoc for main types:', | 112 '# Show pydoc for main types:', |
| 113 'import models', | 113 'import models', |
| 114 'help(models)', | 114 'help(models)', |
| 115 '', | 115 '', |
| 116 '# Show two levels of .text, grouped by first two subdirectories', | 116 '# Show two levels of .text, grouped by first two subdirectories', |
| 117 'text_syms = size_info1.symbols.WhereInSection("t")', | 117 'text_syms = size_info1.symbols.WhereInSection("t")', |
| 118 'by_path = text_syms.GroupByPath(depth=2)', | 118 'by_path = text_syms.GroupBySourcePath(depth=2)', |
| 119 'Print(by_path.WhereBiggerThan(1024))', | 119 'Print(by_path.WhereBiggerThan(1024))', |
| 120 '', | 120 '', |
| 121 '# Show all non-vtable generated symbols', | 121 '# Show all non-vtable generated symbols', |
| 122 'generated_syms = size_info1.symbols.WhereIsGenerated()', | 122 'generated_syms = size_info1.symbols.WhereIsGenerated()', |
| 123 'Print(generated_syms.WhereNameMatches("vtable").Inverted())', | 123 'Print(generated_syms.WhereNameMatches("vtable").Inverted())', |
| 124 '', | 124 '', |
| 125 '*' * 80, | 125 '*' * 80, |
| 126 'Here is some quick reference:', | 126 'Here is some quick reference:', |
| 127 '', | 127 '', |
| 128 'SizeInfo: %s' % ', '.join(symbol_info_keys), | 128 'SizeInfo: %s' % ', '.join(symbol_info_keys), |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if args.query: | 180 if args.query: |
| 181 logging.info('Running query from command-line.') | 181 logging.info('Running query from command-line.') |
| 182 session.Eval(args.query) | 182 session.Eval(args.query) |
| 183 else: | 183 else: |
| 184 logging.info('Entering interactive console.') | 184 logging.info('Entering interactive console.') |
| 185 session.GoInteractive() | 185 session.GoInteractive() |
| 186 | 186 |
| 187 | 187 |
| 188 if __name__ == '__main__': | 188 if __name__ == '__main__': |
| 189 sys.exit(main(sys.argv)) | 189 sys.exit(main(sys.argv)) |
| OLD | NEW |