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 30 matching lines...) Expand all Loading... |
41 ['ls', '-a', '-l', '/data/tombstones'], | 41 ['ls', '-a', '-l', '/data/tombstones'], |
42 as_root=True, check_return=True, env=_TZ_UTC, timeout=60) | 42 as_root=True, check_return=True, env=_TZ_UTC, timeout=60) |
43 for line in lines: | 43 for line in lines: |
44 if 'tombstone' in line and not 'No such file or directory' in line: | 44 if 'tombstone' in line and not 'No such file or directory' in line: |
45 details = line.split() | 45 details = line.split() |
46 t = datetime.datetime.strptime(details[-3] + ' ' + details[-2], | 46 t = datetime.datetime.strptime(details[-3] + ' ' + details[-2], |
47 '%Y-%m-%d %H:%M') | 47 '%Y-%m-%d %H:%M') |
48 yield details[-1], t | 48 yield details[-1], t |
49 except device_errors.CommandFailedError: | 49 except device_errors.CommandFailedError: |
50 logging.exception('Could not retrieve tombstones.') | 50 logging.exception('Could not retrieve tombstones.') |
| 51 except device_errors.CommandTimeoutError: |
| 52 logging.exception('Timed out retrieving tombstones.') |
51 | 53 |
52 | 54 |
53 def _GetDeviceDateTime(device): | 55 def _GetDeviceDateTime(device): |
54 """Determine the date time on the device. | 56 """Determine the date time on the device. |
55 | 57 |
56 Args: | 58 Args: |
57 device: An instance of DeviceUtils. | 59 device: An instance of DeviceUtils. |
58 | 60 |
59 Returns: | 61 Returns: |
60 A datetime instance. | 62 A datetime instance. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 # http://bugs.python.org/issue7980 | 245 # http://bugs.python.org/issue7980 |
244 tombstones = [] | 246 tombstones = [] |
245 for device in devices: | 247 for device in devices: |
246 tombstones += _GetTombstonesForDevice(device, options) | 248 tombstones += _GetTombstonesForDevice(device, options) |
247 | 249 |
248 _ResolveTombstones(options.jobs, tombstones) | 250 _ResolveTombstones(options.jobs, tombstones) |
249 | 251 |
250 | 252 |
251 if __name__ == '__main__': | 253 if __name__ == '__main__': |
252 sys.exit(main()) | 254 sys.exit(main()) |
OLD | NEW |