Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Side by Side Diff: tools/find_runtime_symbols/prepare_symbol_info.py

Issue 367593002: Support --alternative-dirs in tools/find_runtime_symbols/prepare_symbol_info.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 optparse
9 import os 10 import os
10 import re 11 import re
11 import shutil 12 import shutil
12 import subprocess 13 import subprocess
13 import sys 14 import sys
14 import tempfile 15 import tempfile
15 16
16 17
17 BASE_PATH = os.path.dirname(os.path.abspath(__file__)) 18 BASE_PATH = os.path.dirname(os.path.abspath(__file__))
18 REDUCE_DEBUGLINE_PATH = os.path.join(BASE_PATH, 'reduce_debugline.py') 19 REDUCE_DEBUGLINE_PATH = os.path.join(BASE_PATH, 'reduce_debugline.py')
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 203
203 LOGGER.info('Collected symbol information at "%s".' % output_dir_path) 204 LOGGER.info('Collected symbol information at "%s".' % output_dir_path)
204 return output_dir_path, used_tempdir 205 return output_dir_path, used_tempdir
205 206
206 207
207 def main(): 208 def main():
208 if not sys.platform.startswith('linux'): 209 if not sys.platform.startswith('linux'):
209 sys.stderr.write('This script work only on Linux.') 210 sys.stderr.write('This script work only on Linux.')
210 return 1 211 return 1
211 212
213 option_parser = optparse.OptionParser(
214 '%s /path/to/maps [/path/to/output_data_dir/]' % sys.argv[0])
215 option_parser.add_option('--alternative-dirs', dest='alternative_dirs',
216 metavar='/path/on/target@/path/on/host[:...]',
217 help='Read files in /path/on/host/ instead of '
hajimehoshi 2014/08/13 05:13:54 What does '/path/on/host' mean?
Dai Mikurube (NOT FULLTIME) 2014/08/13 05:17:03 It does mean a path on a host machine (e.g. a mach
218 'files in /path/on/target/.')
219 option_parser.add_option('--verbose', dest='verbose', action='store_true',
220 help='Enable verbose mode.')
221 options, args = option_parser.parse_args(sys.argv)
222 alternative_dirs_dict = {}
223 if options.alternative_dirs:
224 for alternative_dir_pair in options.alternative_dirs.split(':'):
225 target_path, host_path = alternative_dir_pair.split('@', 1)
226 alternative_dirs_dict[target_path] = host_path
227
212 LOGGER.setLevel(logging.DEBUG) 228 LOGGER.setLevel(logging.DEBUG)
213 handler = logging.StreamHandler() 229 handler = logging.StreamHandler()
214 handler.setLevel(logging.INFO) 230 if options.verbose:
231 handler.setLevel(logging.DEBUG)
232 else:
233 handler.setLevel(logging.INFO)
215 formatter = logging.Formatter('%(message)s') 234 formatter = logging.Formatter('%(message)s')
216 handler.setFormatter(formatter) 235 handler.setFormatter(formatter)
217 LOGGER.addHandler(handler) 236 LOGGER.addHandler(handler)
218 237
219 # TODO(dmikurube): Specify |alternative_dirs| from command line. 238 if len(args) < 2:
220 if len(sys.argv) < 2: 239 option_parser.error('Argument error.')
221 sys.stderr.write("""Usage:
222 %s /path/to/maps [/path/to/output_data_dir/]
223 """ % sys.argv[0])
224 return 1 240 return 1
225 elif len(sys.argv) == 2: 241 elif len(args) == 2:
226 result, _ = prepare_symbol_info(sys.argv[1]) 242 result, _ = prepare_symbol_info(args[1],
243 alternative_dirs=alternative_dirs_dict)
227 else: 244 else:
228 result, _ = prepare_symbol_info(sys.argv[1], sys.argv[2]) 245 result, _ = prepare_symbol_info(args[1], args[2],
246 alternative_dirs=alternative_dirs_dict)
229 247
230 return not result 248 return not result
231 249
232 250
233 if __name__ == '__main__': 251 if __name__ == '__main__':
234 sys.exit(main()) 252 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698