| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """A tool to collect crash signatures for Chrome builds on Linux.""" | 6 """A tool to collect crash signatures for Chrome builds on Linux.""" |
| 7 | 7 |
| 8 import fnmatch | 8 import fnmatch |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| 11 import shutil | 11 import shutil |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 print GetStackTrace(processor_bin, temp_dir, processed_dump_file) | 258 print GetStackTrace(processor_bin, temp_dir, processed_dump_file) |
| 259 print | 259 print |
| 260 os.remove(processed_dump_file) | 260 os.remove(processed_dump_file) |
| 261 dump_count += 1 | 261 dump_count += 1 |
| 262 | 262 |
| 263 shutil.rmtree(temp_dir) | 263 shutil.rmtree(temp_dir) |
| 264 print '%s dumps found' % dump_count | 264 print '%s dumps found' % dump_count |
| 265 return 0 | 265 return 0 |
| 266 | 266 |
| 267 | 267 |
| 268 if '__main__' == __name__: | 268 def main(): |
| 269 if not sys.platform.startswith('linux'): |
| 270 return 1 |
| 269 parser = optparse.OptionParser() | 271 parser = optparse.OptionParser() |
| 270 parser.add_option('', '--processor-dir', type='string', default='', | 272 parser.add_option('', '--processor-dir', type='string', default='', |
| 271 help='The directory where the processor is installed. ' | 273 help='The directory where the processor is installed. ' |
| 272 'The processor is used to get stack trace from dumps. ' | 274 'The processor is used to get stack trace from dumps. ' |
| 273 'Searches $PATH by default') | 275 'Searches $PATH by default') |
| 274 parser.add_option('', '--dump-file', type='string', default='', | 276 parser.add_option('', '--dump-file', type='string', default='', |
| 275 help='The path of the dump file to be processed. ' | 277 help='The path of the dump file to be processed. ' |
| 276 'Overwrites dump-path.') | 278 'Overwrites dump-path.') |
| 277 parser.add_option('', '--dump-dir', type='string', default='', | 279 parser.add_option('', '--dump-dir', type='string', default='', |
| 278 help='The directory where dump files are stored. ' | 280 help='The directory where dump files are stored. ' |
| 279 'Searches this directory if dump-file is not ' | 281 'Searches this directory if dump-file is not ' |
| 280 'specified. Default is the Chromium crash directory.') | 282 'specified. Default is the Chromium crash directory.') |
| 281 parser.add_option('', '--symbol-dir', default='', | 283 parser.add_option('', '--symbol-dir', default='', |
| 282 help='The directory with the symbols file. [Required]') | 284 help='The directory with the symbols file. [Required]') |
| 283 parser.add_option('', '--symbol-filename', default='', | 285 parser.add_option('', '--symbol-filename', default='', |
| 284 help='The name of the symbols file to use. ' | 286 help='The name of the symbols file to use. ' |
| 285 'This argument overrides --architecture.') | 287 'This argument overrides --architecture.') |
| 286 parser.add_option('', '--architecture', type='int', default=None, | 288 parser.add_option('', '--architecture', type='int', default=None, |
| 287 help='Override automatic x86/x86-64 detection. ' | 289 help='Override automatic x86/x86-64 detection. ' |
| 288 'Valid values are 32 and 64') | 290 'Valid values are 32 and 64') |
| 289 parser.add_option('', '--sym-module-name', type='string', default='chrome', | 291 parser.add_option('', '--sym-module-name', type='string', default='chrome', |
| 290 help='The module name for the symbol file. ' | 292 help='The module name for the symbol file. ' |
| 291 'Default: chrome') | 293 'Default: chrome') |
| 292 | 294 |
| 293 (options, args) = parser.parse_args() | 295 (options, args) = parser.parse_args() |
| 296 return main_linux(options, args) |
| 294 | 297 |
| 295 if sys.platform.startswith('linux'): | 298 |
| 296 sys.exit(main_linux(options, args)) | 299 if '__main__' == __name__: |
| 297 else: | 300 sys.exit(main()) |
| 298 sys.exit(1) | |
| OLD | NEW |