| 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 import json | 6 import json |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import shutil | 10 import shutil |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 nm_filename = _dump_command_result( | 142 nm_filename = _dump_command_result( |
| 143 'nm -n --format bsd %s | c++filt' % entry.name, | 143 'nm -n --format bsd %s | c++filt' % entry.name, |
| 144 output_dir_path, os.path.basename(entry.name), '.nm') | 144 output_dir_path, os.path.basename(entry.name), '.nm') |
| 145 if not nm_filename: | 145 if not nm_filename: |
| 146 continue | 146 continue |
| 147 readelf_e_filename = _dump_command_result( | 147 readelf_e_filename = _dump_command_result( |
| 148 'readelf -eW %s' % entry.name, | 148 'readelf -eW %s' % entry.name, |
| 149 output_dir_path, os.path.basename(entry.name), '.readelf-e') | 149 output_dir_path, os.path.basename(entry.name), '.readelf-e') |
| 150 if not readelf_e_filename: | 150 if not readelf_e_filename: |
| 151 continue | 151 continue |
| 152 readelf_reduced_debugline_filename = None | 152 readelf_debug_decodedline_file = None |
| 153 if use_source_file_name: | 153 if use_source_file_name: |
| 154 readelf_reduced_debugline_filename = _dump_command_result( | 154 readelf_debug_decodedline_file = _dump_command_result( |
| 155 'readelf -wLW %s | %s' % (entry.name, REDUCE_DEBUGLINE_PATH), | 155 'readelf -wLW %s | %s' % (entry.name, REDUCE_DEBUGLINE_PATH), |
| 156 output_dir_path, os.path.basename(entry.name), '.readelf-debugline') | 156 output_dir_path, os.path.basename(entry.name), '.readelf-wL') |
| 157 | 157 |
| 158 files[entry.name] = {} | 158 files[entry.name] = {} |
| 159 files[entry.name]['nm'] = { | 159 files[entry.name]['nm'] = { |
| 160 'file': os.path.basename(nm_filename), | 160 'file': os.path.basename(nm_filename), |
| 161 'format': 'bsd', | 161 'format': 'bsd', |
| 162 'mangled': False} | 162 'mangled': False} |
| 163 files[entry.name]['readelf-e'] = { | 163 files[entry.name]['readelf-e'] = { |
| 164 'file': os.path.basename(readelf_e_filename)} | 164 'file': os.path.basename(readelf_e_filename)} |
| 165 if readelf_reduced_debugline_filename: | 165 if readelf_debug_decodedline_file: |
| 166 files[entry.name]['readelf-reduced-debugline'] = { | 166 files[entry.name]['readelf-debug-decodedline-file'] = { |
| 167 'file': os.path.basename(readelf_reduced_debugline_filename)} | 167 'file': os.path.basename(readelf_debug_decodedline_file)} |
| 168 | 168 |
| 169 with open(os.path.join(output_dir_path, 'files.json'), 'w') as f: | 169 with open(os.path.join(output_dir_path, 'files.json'), 'w') as f: |
| 170 json.dump(files, f, indent=2, sort_keys=True) | 170 json.dump(files, f, indent=2, sort_keys=True) |
| 171 | 171 |
| 172 LOGGER.info('Collected symbol information at "%s".' % output_dir_path) | 172 LOGGER.info('Collected symbol information at "%s".' % output_dir_path) |
| 173 return output_dir_path, used_tempdir | 173 return output_dir_path, used_tempdir |
| 174 | 174 |
| 175 | 175 |
| 176 def main(): | 176 def main(): |
| 177 if not sys.platform.startswith('linux'): | 177 if not sys.platform.startswith('linux'): |
| (...skipping 15 matching lines...) Expand all Loading... |
| 193 elif len(sys.argv) == 2: | 193 elif len(sys.argv) == 2: |
| 194 result, _ = prepare_symbol_info(sys.argv[1]) | 194 result, _ = prepare_symbol_info(sys.argv[1]) |
| 195 else: | 195 else: |
| 196 result, _ = prepare_symbol_info(sys.argv[1], sys.argv[2]) | 196 result, _ = prepare_symbol_info(sys.argv[1], sys.argv[2]) |
| 197 | 197 |
| 198 return not result | 198 return not result |
| 199 | 199 |
| 200 | 200 |
| 201 if __name__ == '__main__': | 201 if __name__ == '__main__': |
| 202 sys.exit(main()) | 202 sys.exit(main()) |
| OLD | NEW |