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. |
11 | 11 |
12 import datetime | 12 import datetime |
13 import logging | 13 import logging |
14 import multiprocessing | 14 import multiprocessing |
15 import os | 15 import os |
16 import re | 16 import re |
17 import subprocess | 17 import subprocess |
18 import sys | 18 import sys |
19 import optparse | 19 import optparse |
20 | 20 |
21 import devil_chromium | |
22 | |
23 from devil.android import device_blacklist | 21 from devil.android import device_blacklist |
24 from devil.android import device_errors | 22 from devil.android import device_errors |
25 from devil.android import device_utils | 23 from devil.android import device_utils |
26 from devil.utils import run_tests_helper | 24 from devil.utils import run_tests_helper |
27 | 25 |
28 _TZ_UTC = {'TZ': 'UTC'} | 26 _TZ_UTC = {'TZ': 'UTC'} |
29 | 27 |
30 def _ListTombstones(device): | 28 def _ListTombstones(device): |
31 """List the tombstone files on the device. | 29 """List the tombstone files on the device. |
32 | 30 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 parser.add_option('-j', '--jobs', type='int', | 231 parser.add_option('-j', '--jobs', type='int', |
234 default=4, | 232 default=4, |
235 help='Number of jobs to use when processing multiple ' | 233 help='Number of jobs to use when processing multiple ' |
236 'crash stacks.') | 234 'crash stacks.') |
237 options, _ = parser.parse_args() | 235 options, _ = parser.parse_args() |
238 | 236 |
239 blacklist = (device_blacklist.Blacklist(options.blacklist_file) | 237 blacklist = (device_blacklist.Blacklist(options.blacklist_file) |
240 if options.blacklist_file | 238 if options.blacklist_file |
241 else None) | 239 else None) |
242 | 240 |
243 devil_chromium.Initialize() | |
244 | |
245 if options.device: | 241 if options.device: |
246 devices = [device_utils.DeviceUtils(options.device)] | 242 devices = [device_utils.DeviceUtils(options.device)] |
247 else: | 243 else: |
248 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) | 244 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |
249 | 245 |
250 # This must be done serially because strptime can hit a race condition if | 246 # This must be done serially because strptime can hit a race condition if |
251 # used for the first time in a multithreaded environment. | 247 # used for the first time in a multithreaded environment. |
252 # http://bugs.python.org/issue7980 | 248 # http://bugs.python.org/issue7980 |
253 tombstones = [] | 249 tombstones = [] |
254 for device in devices: | 250 for device in devices: |
255 tombstones += _GetTombstonesForDevice(device, options) | 251 tombstones += _GetTombstonesForDevice(device, options) |
256 | 252 |
257 _ResolveTombstones(options.jobs, tombstones) | 253 _ResolveTombstones(options.jobs, tombstones) |
258 | 254 |
259 | 255 |
260 if __name__ == '__main__': | 256 if __name__ == '__main__': |
261 sys.exit(main()) | 257 sys.exit(main()) |
OLD | NEW |