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 blacklist = (device_blacklist.Blacklist(options.blacklist_file) | 238 if options.blacklist_file: |
239 if options.blacklist_file | 239 blacklist = device_blacklist.Blacklist(options.blacklist_file) |
240 else None) | 240 else: |
| 241 blacklist = None |
241 | 242 |
242 if options.device: | 243 if options.device: |
243 devices = [device_utils.DeviceUtils(options.device)] | 244 devices = [device_utils.DeviceUtils(options.device)] |
244 else: | 245 else: |
245 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) | 246 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |
246 | 247 |
247 # This must be done serially because strptime can hit a race condition if | 248 # This must be done serially because strptime can hit a race condition if |
248 # used for the first time in a multithreaded environment. | 249 # used for the first time in a multithreaded environment. |
249 # http://bugs.python.org/issue7980 | 250 # http://bugs.python.org/issue7980 |
250 tombstones = [] | 251 tombstones = [] |
251 for device in devices: | 252 for device in devices: |
252 tombstones += _GetTombstonesForDevice(device, options) | 253 tombstones += _GetTombstonesForDevice(device, options) |
253 | 254 |
254 _ResolveTombstones(options.jobs, tombstones) | 255 _ResolveTombstones(options.jobs, tombstones) |
255 | 256 |
256 | 257 |
257 if __name__ == '__main__': | 258 if __name__ == '__main__': |
258 sys.exit(main()) | 259 sys.exit(main()) |
OLD | NEW |