| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 parser.add_option('-s', '--stack', action='store_true', | 228 parser.add_option('-s', '--stack', action='store_true', |
| 229 help='Also include symbols for stack data') | 229 help='Also include symbols for stack data') |
| 230 parser.add_option('-w', '--wipe-tombstones', action='store_true', | 230 parser.add_option('-w', '--wipe-tombstones', action='store_true', |
| 231 help='Erase all tombstones from device after processing') | 231 help='Erase all tombstones from device after processing') |
| 232 parser.add_option('-j', '--jobs', type='int', | 232 parser.add_option('-j', '--jobs', type='int', |
| 233 default=4, | 233 default=4, |
| 234 help='Number of jobs to use when processing multiple ' | 234 help='Number of jobs to use when processing multiple ' |
| 235 'crash stacks.') | 235 'crash stacks.') |
| 236 options, _ = parser.parse_args() | 236 options, _ = parser.parse_args() |
| 237 | 237 |
| 238 if options.blacklist_file: | 238 blacklist = (device_blacklist.Blacklist(options.blacklist_file) |
| 239 blacklist = device_blacklist.Blacklist(options.blacklist_file) | 239 if options.blacklist_file |
| 240 else: | 240 else None) |
| 241 blacklist = None | |
| 242 | 241 |
| 243 if options.device: | 242 if options.device: |
| 244 devices = [device_utils.DeviceUtils(options.device)] | 243 devices = [device_utils.DeviceUtils(options.device)] |
| 245 else: | 244 else: |
| 246 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) | 245 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |
| 247 | 246 |
| 248 # This must be done serially because strptime can hit a race condition if | 247 # This must be done serially because strptime can hit a race condition if |
| 249 # used for the first time in a multithreaded environment. | 248 # used for the first time in a multithreaded environment. |
| 250 # http://bugs.python.org/issue7980 | 249 # http://bugs.python.org/issue7980 |
| 251 tombstones = [] | 250 tombstones = [] |
| 252 for device in devices: | 251 for device in devices: |
| 253 tombstones += _GetTombstonesForDevice(device, options) | 252 tombstones += _GetTombstonesForDevice(device, options) |
| 254 | 253 |
| 255 _ResolveTombstones(options.jobs, tombstones) | 254 _ResolveTombstones(options.jobs, tombstones) |
| 256 | 255 |
| 257 | 256 |
| 258 if __name__ == '__main__': | 257 if __name__ == '__main__': |
| 259 sys.exit(main()) | 258 sys.exit(main()) |
| OLD | NEW |