Chromium Code Reviews| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 parser.add_option('-s', '--stack', action='store_true', | 234 parser.add_option('-s', '--stack', action='store_true', |
| 235 help='Also include symbols for stack data') | 235 help='Also include symbols for stack data') |
| 236 parser.add_option('-w', '--wipe-tombstones', action='store_true', | 236 parser.add_option('-w', '--wipe-tombstones', action='store_true', |
| 237 help='Erase all tombstones from device after processing') | 237 help='Erase all tombstones from device after processing') |
| 238 parser.add_option('-j', '--jobs', type='int', | 238 parser.add_option('-j', '--jobs', type='int', |
| 239 default=4, | 239 default=4, |
| 240 help='Number of jobs to use when processing multiple ' | 240 help='Number of jobs to use when processing multiple ' |
| 241 'crash stacks.') | 241 'crash stacks.') |
| 242 parser.add_option('--output-directory', | 242 parser.add_option('--output-directory', |
| 243 help='Path to the root build directory.') | 243 help='Path to the root build directory.') |
| 244 parser.add_option('--adb-path', help='Absolute path to the adb binary.') | |
|
mikecase (-- gone --)
2016/05/28 00:57:12
Have you considered enforcing this is os.path.isab
jbudorick
2016/05/28 01:27:30
I hadn't. I instead made the script make the path
| |
| 244 options, _ = parser.parse_args() | 245 options, _ = parser.parse_args() |
| 245 | 246 |
| 246 devil_chromium.Initialize() | 247 devil_chromium.Initialize(adb_path=options.adb_path) |
| 247 | 248 |
| 248 blacklist = (device_blacklist.Blacklist(options.blacklist_file) | 249 blacklist = (device_blacklist.Blacklist(options.blacklist_file) |
| 249 if options.blacklist_file | 250 if options.blacklist_file |
| 250 else None) | 251 else None) |
| 251 | 252 |
| 252 if options.output_directory: | 253 if options.output_directory: |
| 253 constants.SetOutputDirectory(options.output_directory) | 254 constants.SetOutputDirectory(options.output_directory) |
| 254 # Do an up-front test that the output directory is known. | 255 # Do an up-front test that the output directory is known. |
| 255 constants.CheckOutputDirectory() | 256 constants.CheckOutputDirectory() |
| 256 | 257 |
| 257 if options.device: | 258 if options.device: |
| 258 devices = [device_utils.DeviceUtils(options.device)] | 259 devices = [device_utils.DeviceUtils(options.device)] |
| 259 else: | 260 else: |
| 260 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) | 261 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |
| 261 | 262 |
| 262 # This must be done serially because strptime can hit a race condition if | 263 # This must be done serially because strptime can hit a race condition if |
| 263 # used for the first time in a multithreaded environment. | 264 # used for the first time in a multithreaded environment. |
| 264 # http://bugs.python.org/issue7980 | 265 # http://bugs.python.org/issue7980 |
| 265 tombstones = [] | 266 tombstones = [] |
| 266 for device in devices: | 267 for device in devices: |
| 267 tombstones += _GetTombstonesForDevice(device, options) | 268 tombstones += _GetTombstonesForDevice(device, options) |
| 268 | 269 |
| 269 _ResolveTombstones(options.jobs, tombstones) | 270 _ResolveTombstones(options.jobs, tombstones) |
| 270 | 271 |
| 271 | 272 |
| 272 if __name__ == '__main__': | 273 if __name__ == '__main__': |
| 273 sys.exit(main()) | 274 sys.exit(main()) |
| OLD | NEW |