| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 try: | 42 try: |
| 43 if not device.PathExists('/data/tombstones', as_root=True): | 43 if not device.PathExists('/data/tombstones', as_root=True): |
| 44 return | 44 return |
| 45 entries = device.StatDirectory('/data/tombstones', as_root=True) | 45 entries = device.StatDirectory('/data/tombstones', as_root=True) |
| 46 for entry in entries: | 46 for entry in entries: |
| 47 if 'tombstone' in entry['filename']: | 47 if 'tombstone' in entry['filename']: |
| 48 yield (entry['filename'], | 48 yield (entry['filename'], |
| 49 datetime.datetime.fromtimestamp(entry['st_mtime'])) | 49 datetime.datetime.fromtimestamp(entry['st_mtime'])) |
| 50 except device_errors.CommandFailedError: | 50 except device_errors.CommandFailedError: |
| 51 logging.exception('Could not retrieve tombstones.') | 51 logging.exception('Could not retrieve tombstones.') |
| 52 except device_errors.DeviceUnreachableError: |
| 53 logging.exception('Device unreachable retrieving tombstones.') |
| 52 except device_errors.CommandTimeoutError: | 54 except device_errors.CommandTimeoutError: |
| 53 logging.exception('Timed out retrieving tombstones.') | 55 logging.exception('Timed out retrieving tombstones.') |
| 54 | 56 |
| 55 | 57 |
| 56 def _GetDeviceDateTime(device): | 58 def _GetDeviceDateTime(device): |
| 57 """Determine the date time on the device. | 59 """Determine the date time on the device. |
| 58 | 60 |
| 59 Args: | 61 Args: |
| 60 device: An instance of DeviceUtils. | 62 device: An instance of DeviceUtils. |
| 61 | 63 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 for device in devices: | 306 for device in devices: |
| 305 resolved_tombstones = ResolveTombstones( | 307 resolved_tombstones = ResolveTombstones( |
| 306 device, args.all_tombstones, | 308 device, args.all_tombstones, |
| 307 args.stack, args.wipe_tombstones, args.jobs) | 309 args.stack, args.wipe_tombstones, args.jobs) |
| 308 for line in resolved_tombstones: | 310 for line in resolved_tombstones: |
| 309 logging.info(line) | 311 logging.info(line) |
| 310 | 312 |
| 311 | 313 |
| 312 if __name__ == '__main__': | 314 if __name__ == '__main__': |
| 313 sys.exit(main()) | 315 sys.exit(main()) |
| OLD | NEW |