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 multiprocessing | 14 import multiprocessing |
14 import os | 15 import os |
15 import subprocess | 16 import subprocess |
16 import sys | 17 import sys |
17 import optparse | 18 import optparse |
18 | 19 |
19 from pylib import android_commands | 20 from pylib import android_commands |
20 | 21 |
21 | 22 |
22 def _ListTombstones(adb): | 23 def _ListTombstones(adb): |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 help="""Resolve symbols for all tombstones, rather than just | 170 help="""Resolve symbols for all tombstones, rather than just |
170 the most recent""") | 171 the most recent""") |
171 parser.add_option('-s', '--stack', action='store_true', | 172 parser.add_option('-s', '--stack', action='store_true', |
172 help='Also include symbols for stack data') | 173 help='Also include symbols for stack data') |
173 parser.add_option('-w', '--wipe-tombstones', action='store_true', | 174 parser.add_option('-w', '--wipe-tombstones', action='store_true', |
174 help='Erase all tombstones from device after processing') | 175 help='Erase all tombstones from device after processing') |
175 parser.add_option('-j', '--jobs', type='int', | 176 parser.add_option('-j', '--jobs', type='int', |
176 default=4, | 177 default=4, |
177 help='Number of jobs to use when processing multiple ' | 178 help='Number of jobs to use when processing multiple ' |
178 'crash stacks.') | 179 'crash stacks.') |
179 options, _ = parser.parse_args() | 180 options, args = parser.parse_args() |
180 | 181 |
181 if options.device: | 182 if options.device: |
182 devices = [options.device] | 183 devices = [options.device] |
183 else: | 184 else: |
184 devices = android_commands.GetAttachedDevices() | 185 devices = android_commands.GetAttachedDevices() |
185 | 186 |
186 tombstones = [] | 187 tombstones = [] |
187 for device in devices: | 188 for device in devices: |
188 adb = android_commands.AndroidCommands(device) | 189 adb = android_commands.AndroidCommands(device) |
189 tombstones += _GetTombstonesForDevice(adb, options) | 190 tombstones += _GetTombstonesForDevice(adb, options) |
190 | 191 |
191 _ResolveTombstones(options.jobs, tombstones) | 192 _ResolveTombstones(options.jobs, tombstones) |
192 | 193 |
193 if __name__ == '__main__': | 194 if __name__ == '__main__': |
194 sys.exit(main()) | 195 sys.exit(main()) |
OLD | NEW |