| 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 hashlib | 6 import hashlib |
| 7 import json | 7 import json |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 LOGGER.debug('Listing up symbols.') | 148 LOGGER.debug('Listing up symbols.') |
| 149 files = {} | 149 files = {} |
| 150 for entry in maps.iter(ProcMaps.executable): | 150 for entry in maps.iter(ProcMaps.executable): |
| 151 LOGGER.debug(' %016x-%016x +%06x %s' % ( | 151 LOGGER.debug(' %016x-%016x +%06x %s' % ( |
| 152 entry.begin, entry.end, entry.offset, entry.name)) | 152 entry.begin, entry.end, entry.offset, entry.name)) |
| 153 binary_path = entry.name | 153 binary_path = entry.name |
| 154 for target_path, host_path in alternative_dirs.iteritems(): | 154 for target_path, host_path in alternative_dirs.iteritems(): |
| 155 if entry.name.startswith(target_path): | 155 if entry.name.startswith(target_path): |
| 156 binary_path = entry.name.replace(target_path, host_path, 1) | 156 binary_path = entry.name.replace(target_path, host_path, 1) |
| 157 if not (ProcMaps.EXECUTABLE_PATTERN.match(binary_path) or |
| 158 (os.path.isfile(binary_path) and os.access(binary_path, os.X_OK))): |
| 159 continue |
| 157 nm_filename = _dump_command_result( | 160 nm_filename = _dump_command_result( |
| 158 'nm -n --format bsd %s | c++filt' % binary_path, | 161 'nm -n --format bsd %s | c++filt' % binary_path, |
| 159 output_dir_path, os.path.basename(binary_path), '.nm') | 162 output_dir_path, os.path.basename(binary_path), '.nm') |
| 160 if not nm_filename: | 163 if not nm_filename: |
| 161 continue | 164 continue |
| 162 readelf_e_filename = _dump_command_result( | 165 readelf_e_filename = _dump_command_result( |
| 163 'readelf -eW %s' % binary_path, | 166 'readelf -eW %s' % binary_path, |
| 164 output_dir_path, os.path.basename(binary_path), '.readelf-e') | 167 output_dir_path, os.path.basename(binary_path), '.readelf-e') |
| 165 if not readelf_e_filename: | 168 if not readelf_e_filename: |
| 166 continue | 169 continue |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 elif len(sys.argv) == 2: | 225 elif len(sys.argv) == 2: |
| 223 result, _ = prepare_symbol_info(sys.argv[1]) | 226 result, _ = prepare_symbol_info(sys.argv[1]) |
| 224 else: | 227 else: |
| 225 result, _ = prepare_symbol_info(sys.argv[1], sys.argv[2]) | 228 result, _ = prepare_symbol_info(sys.argv[1], sys.argv[2]) |
| 226 | 229 |
| 227 return not result | 230 return not result |
| 228 | 231 |
| 229 | 232 |
| 230 if __name__ == '__main__': | 233 if __name__ == '__main__': |
| 231 sys.exit(main()) | 234 sys.exit(main()) |
| OLD | NEW |