| OLD | NEW |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 """Methods for converting model objects to human-readable formats.""" | 4 """Methods for converting model objects to human-readable formats.""" |
| 5 | 5 |
| 6 import datetime | 6 import datetime |
| 7 import itertools | 7 import itertools |
| 8 import time | 8 import time |
| 9 | 9 |
| 10 import models | 10 import models |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 else: | 74 else: |
| 75 address = hex(sym.address) | 75 address = hex(sym.address) |
| 76 if self.verbose: | 76 if self.verbose: |
| 77 count_part = ' count=%d' % len(sym) if sym.IsGroup() else '' | 77 count_part = ' count=%d' % len(sym) if sym.IsGroup() else '' |
| 78 yield '{}@{:<9s} size={} padding={} size_without_padding={}{}'.format( | 78 yield '{}@{:<9s} size={} padding={} size_without_padding={}{}'.format( |
| 79 sym.section, address, sym.size, sym.padding, sym.size_without_padding, | 79 sym.section, address, sym.size, sym.padding, sym.size_without_padding, |
| 80 count_part) | 80 count_part) |
| 81 yield ' source_path={} \tobject_path={}'.format( | 81 yield ' source_path={} \tobject_path={}'.format( |
| 82 sym.source_path, sym.object_path) | 82 sym.source_path, sym.object_path) |
| 83 if sym.name: | 83 if sym.name: |
| 84 yield ' is_anonymous={} name={}'.format( | 84 yield ' flags={} name={}'.format(sym.FlagsString(), sym.name) |
| 85 int(sym.is_anonymous), sym.name) | |
| 86 if sym.full_name: | 85 if sym.full_name: |
| 87 yield ' full_name={}'.format(sym.full_name) | 86 yield ' full_name={}'.format(sym.full_name) |
| 88 elif sym.full_name: | 87 elif sym.full_name: |
| 89 yield ' is_anonymous={} full_name={}'.format( | 88 yield ' flags={} full_name={}'.format( |
| 90 int(sym.is_anonymous), sym.full_name) | 89 sym.FlagsString(), sym.full_name) |
| 91 else: | 90 else: |
| 92 yield '{}@{:<9s} {:<7} {}'.format( | 91 yield '{}@{:<9s} {:<7} {}'.format( |
| 93 sym.section, address, sym.size, | 92 sym.section, address, sym.size, |
| 94 sym.source_path or sym.object_path or '{no path}') | 93 sym.source_path or sym.object_path or '{no path}') |
| 95 if sym.name: | 94 if sym.name: |
| 96 count_part = ' (count=%d)' % len(sym) if sym.IsGroup() else '' | 95 count_part = ' (count=%d)' % len(sym) if sym.IsGroup() else '' |
| 97 yield ' {}{}'.format(sym.name, count_part) | 96 yield ' {}{}'.format(sym.name, count_part) |
| 98 | 97 |
| 99 def _DescribeSymbolGroupChildren(self, group, indent=0): | 98 def _DescribeSymbolGroupChildren(self, group, indent=0): |
| 100 running_total = 0 | 99 running_total = 0 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 276 |
| 278 def GenerateLines(obj, verbose=False, recursive=False): | 277 def GenerateLines(obj, verbose=False, recursive=False): |
| 279 """Returns an iterable of lines (without \n) that describes |obj|.""" | 278 """Returns an iterable of lines (without \n) that describes |obj|.""" |
| 280 return Describer(verbose=verbose, recursive=recursive).GenerateLines(obj) | 279 return Describer(verbose=verbose, recursive=recursive).GenerateLines(obj) |
| 281 | 280 |
| 282 | 281 |
| 283 def WriteLines(lines, func): | 282 def WriteLines(lines, func): |
| 284 for l in lines: | 283 for l in lines: |
| 285 func(l) | 284 func(l) |
| 286 func('\n') | 285 func('\n') |
| OLD | NEW |