Chromium Code Reviews| Index: build/android/tombstones.py |
| diff --git a/build/android/tombstones.py b/build/android/tombstones.py |
| index ebe1bf8bebe56b52ad7ccf990f47d2dafb638d0b..1760301e3df230c529264f01f990bdc1a3c3078b 100755 |
| --- a/build/android/tombstones.py |
| +++ b/build/android/tombstones.py |
| @@ -12,6 +12,7 @@ |
| import datetime |
| import multiprocessing |
| import os |
| +import re |
| import subprocess |
| import sys |
| import optparse |
| @@ -76,7 +77,18 @@ def _EraseTombstone(device, tombstone_file): |
| 'rm /data/tombstones/' + tombstone_file, as_root=True) |
| -def _ResolveSymbols(tombstone_data, include_stack, arch): |
| +def _DeviceAbiToArch(device_abi): |
| + # The order of this list is significant to find the more specific match (e.g., |
| + # arm64) before the less specific (e.g., arm). |
| + arches = ['arm64', 'arm', 'x86_64', 'x86_64', 'x86', 'mips'] |
| + for arch in arches: |
| + if arch in device_abi: |
| + return arch |
| + |
| + print 'Error: Unknown device ABI' |
|
Sami
2014/08/07 12:00:17
How about a more noisy and informative "raise Runt
rmcilroy
2014/08/07 12:43:37
Done.
|
| + return None |
| + |
| +def _ResolveSymbols(tombstone_data, include_stack, device_abi): |
| """Run the stack tool for given tombstone input. |
| Args: |
| @@ -87,6 +99,16 @@ def _ResolveSymbols(tombstone_data, include_stack, arch): |
| Yields: |
| A string for each line of resolved stack output. |
| """ |
| + # Check if the tombstone data has am ABI listed, if so use this in preference |
|
Sami
2014/08/07 12:00:17
s/am/an/
rmcilroy
2014/08/07 12:43:37
Done.
|
| + # to the devices default ABI. |
|
Sami
2014/08/07 12:00:17
s/devices/device's/
rmcilroy
2014/08/07 12:43:37
Done.
|
| + for line in tombstone_data: |
| + found_abi = re.search('ABI: \'(.+?)\'', line) |
| + if found_abi: |
| + device_abi = found_abi.group(1) |
| + arch = _DeviceAbiToArch(device_abi) |
| + if not arch: |
| + return |
| + |
| stack_tool = os.path.join(os.path.dirname(__file__), '..', '..', |
| 'third_party', 'android_platform', 'development', |
| 'scripts', 'stack') |
| @@ -108,7 +130,7 @@ def _ResolveTombstone(tombstone): |
| print '\n'.join(lines) |
| print 'Resolving...' |
| lines += _ResolveSymbols(tombstone['data'], tombstone['stack'], |
| - tombstone['arch']) |
| + tombstone['device_abi']) |
| return lines |
| @@ -153,7 +175,7 @@ def _GetTombstonesForDevice(device, options): |
| device_now = _GetDeviceDateTime(device) |
| for tombstone_file, tombstone_time in tombstones: |
| ret += [{'serial': str(device), |
| - 'arch': device.GetProp('ro.product.cpu.abi'), |
| + 'device_abi': device.GetProp('ro.product.cpu.abi'), |
| 'device_now': device_now, |
| 'time': tombstone_time, |
| 'file': tombstone_file, |