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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 # Erase all the tombstones if desired. | 157 # Erase all the tombstones if desired. |
158 if options.wipe_tombstones: | 158 if options.wipe_tombstones: |
159 for tombstone_file, _ in all_tombstones: | 159 for tombstone_file, _ in all_tombstones: |
160 _EraseTombstone(adb, tombstone_file) | 160 _EraseTombstone(adb, tombstone_file) |
161 | 161 |
162 return ret | 162 return ret |
163 | 163 |
164 def main(): | 164 def main(): |
165 parser = optparse.OptionParser() | 165 parser = optparse.OptionParser() |
| 166 parser.add_option('--device', |
| 167 help='The serial number of the device. If not specified ' |
| 168 'will use all devices.') |
166 parser.add_option('-a', '--all-tombstones', action='store_true', | 169 parser.add_option('-a', '--all-tombstones', action='store_true', |
167 dest='all_tombstones', default=False, | |
168 help="""Resolve symbols for all tombstones, rather than just | 170 help="""Resolve symbols for all tombstones, rather than just |
169 the most recent""") | 171 the most recent""") |
170 parser.add_option('-s', '--stack', action='store_true', | 172 parser.add_option('-s', '--stack', action='store_true', |
171 dest='stack', default=False, | |
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 dest='wipe_tombstones', default=False, | |
175 help='Erase all tombstones from device after processing') | 175 help='Erase all tombstones from device after processing') |
176 parser.add_option('-j', '--jobs', type='int', | 176 parser.add_option('-j', '--jobs', type='int', |
177 default=4, | 177 default=4, |
178 help='Number of jobs to use when processing multiple ' | 178 help='Number of jobs to use when processing multiple ' |
179 'crash stacks.') | 179 'crash stacks.') |
180 options, args = parser.parse_args() | 180 options, args = parser.parse_args() |
181 | 181 |
182 devices = android_commands.GetAttachedDevices() | 182 if options.device: |
| 183 devices = [options.device] |
| 184 else: |
| 185 devices = android_commands.GetAttachedDevices() |
| 186 |
183 tombstones = [] | 187 tombstones = [] |
184 for device in devices: | 188 for device in devices: |
185 adb = android_commands.AndroidCommands(device) | 189 adb = android_commands.AndroidCommands(device) |
186 tombstones += _GetTombstonesForDevice(adb, options) | 190 tombstones += _GetTombstonesForDevice(adb, options) |
187 | 191 |
188 _ResolveTombstones(options.jobs, tombstones) | 192 _ResolveTombstones(options.jobs, tombstones) |
189 | 193 |
190 if __name__ == '__main__': | 194 if __name__ == '__main__': |
191 sys.exit(main()) | 195 sys.exit(main()) |
OLD | NEW |