| OLD | NEW | 
|    1 #!/usr/bin/env python |    1 #!/usr/bin/env python | 
|    2 # |    2 # | 
|    3 # Copyright 2013 The Chromium Authors. All rights reserved. |    3 # Copyright 2013 The Chromium Authors. All rights reserved. | 
|    4 # Use of this source code is governed by a BSD-style license that can be |    4 # Use of this source code is governed by a BSD-style license that can be | 
|    5 # found in the LICENSE file. |    5 # found in the LICENSE file. | 
|    6 # |    6 # | 
|    7 # Find the most recent tombstone file(s) on all connected devices |    7 # Find the most recent tombstone file(s) on all connected devices | 
|    8 # and prints their stacks. |    8 # and prints their stacks. | 
|    9 # |    9 # | 
|   10 # Assumes tombstone file was created with current symbols. |   10 # Assumes tombstone file was created with current symbols. | 
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  230   parser.add_option('-s', '--stack', action='store_true', |  230   parser.add_option('-s', '--stack', action='store_true', | 
|  231                     help='Also include symbols for stack data') |  231                     help='Also include symbols for stack data') | 
|  232   parser.add_option('-w', '--wipe-tombstones', action='store_true', |  232   parser.add_option('-w', '--wipe-tombstones', action='store_true', | 
|  233                     help='Erase all tombstones from device after processing') |  233                     help='Erase all tombstones from device after processing') | 
|  234   parser.add_option('-j', '--jobs', type='int', |  234   parser.add_option('-j', '--jobs', type='int', | 
|  235                     default=4, |  235                     default=4, | 
|  236                     help='Number of jobs to use when processing multiple ' |  236                     help='Number of jobs to use when processing multiple ' | 
|  237                          'crash stacks.') |  237                          'crash stacks.') | 
|  238   options, _ = parser.parse_args() |  238   options, _ = parser.parse_args() | 
|  239  |  239  | 
|  240   if options.blacklist_file: |  240   blacklist = (device_blacklist.Blacklist(options.blacklist_file) | 
|  241     blacklist = device_blacklist.Blacklist(options.blacklist_file) |  241                if options.blacklist_file | 
|  242   else: |  242                else None) | 
|  243     blacklist = None |  | 
|  244  |  243  | 
|  245   if options.device: |  244   if options.device: | 
|  246     devices = [device_utils.DeviceUtils(options.device)] |  245     devices = [device_utils.DeviceUtils(options.device)] | 
|  247   else: |  246   else: | 
|  248     devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |  247     devices = device_utils.DeviceUtils.HealthyDevices(blacklist) | 
|  249  |  248  | 
|  250   # This must be done serially because strptime can hit a race condition if |  249   # This must be done serially because strptime can hit a race condition if | 
|  251   # used for the first time in a multithreaded environment. |  250   # used for the first time in a multithreaded environment. | 
|  252   # http://bugs.python.org/issue7980 |  251   # http://bugs.python.org/issue7980 | 
|  253   tombstones = [] |  252   tombstones = [] | 
|  254   for device in devices: |  253   for device in devices: | 
|  255     tombstones += _GetTombstonesForDevice(device, options) |  254     tombstones += _GetTombstonesForDevice(device, options) | 
|  256  |  255  | 
|  257   _ResolveTombstones(options.jobs, tombstones) |  256   _ResolveTombstones(options.jobs, tombstones) | 
|  258  |  257  | 
|  259  |  258  | 
|  260 if __name__ == '__main__': |  259 if __name__ == '__main__': | 
|  261   sys.exit(main()) |  260   sys.exit(main()) | 
| OLD | NEW |