Commit 02c4ace3 authored by rmcilroy@chromium.org's avatar rmcilroy@chromium.org

[Android]: Fix tombstones.py architecture detection.

This CL fixes tombstones.py architecture detection in two ways:
 - If the tombstone contains an ABI line, use this in preference to the devices
   default ABI, since some devices support multiple ABIs (e.g., 'arm' and 'arm64').
 - Map the abi to an arch which the stack tool accepts, e.g., armeabi-v7a -> arm, arm64-v8a -> arm64.

NOTRY=true

Review URL: https://codereview.chromium.org/446273003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288072 0039d316-1c4b-4281-b951-d872f2087c98
parent b385d080
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
import datetime import datetime
import multiprocessing import multiprocessing
import os import os
import re
import subprocess import subprocess
import sys import sys
import optparse import optparse
...@@ -76,17 +77,36 @@ def _EraseTombstone(device, tombstone_file): ...@@ -76,17 +77,36 @@ def _EraseTombstone(device, tombstone_file):
'rm /data/tombstones/' + tombstone_file, as_root=True) '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
raise RuntimeError('Unknown device ABI: %s' % device_abi)
def _ResolveSymbols(tombstone_data, include_stack, device_abi):
"""Run the stack tool for given tombstone input. """Run the stack tool for given tombstone input.
Args: Args:
tombstone_data: a list of strings of tombstone data. tombstone_data: a list of strings of tombstone data.
include_stack: boolean whether to include stack data in output. include_stack: boolean whether to include stack data in output.
arch: the device architecture of tombstone data. device_abi: the default ABI of the device which generated the tombstone.
Yields: Yields:
A string for each line of resolved stack output. A string for each line of resolved stack output.
""" """
# Check if the tombstone data has an ABI listed, if so use this in preference
# to the device's default ABI.
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__), '..', '..', stack_tool = os.path.join(os.path.dirname(__file__), '..', '..',
'third_party', 'android_platform', 'development', 'third_party', 'android_platform', 'development',
'scripts', 'stack') 'scripts', 'stack')
...@@ -108,7 +128,7 @@ def _ResolveTombstone(tombstone): ...@@ -108,7 +128,7 @@ def _ResolveTombstone(tombstone):
print '\n'.join(lines) print '\n'.join(lines)
print 'Resolving...' print 'Resolving...'
lines += _ResolveSymbols(tombstone['data'], tombstone['stack'], lines += _ResolveSymbols(tombstone['data'], tombstone['stack'],
tombstone['arch']) tombstone['device_abi'])
return lines return lines
...@@ -153,7 +173,7 @@ def _GetTombstonesForDevice(device, options): ...@@ -153,7 +173,7 @@ def _GetTombstonesForDevice(device, options):
device_now = _GetDeviceDateTime(device) device_now = _GetDeviceDateTime(device)
for tombstone_file, tombstone_time in tombstones: for tombstone_file, tombstone_time in tombstones:
ret += [{'serial': str(device), ret += [{'serial': str(device),
'arch': device.GetProp('ro.product.cpu.abi'), 'device_abi': device.GetProp('ro.product.cpu.abi'),
'device_now': device_now, 'device_now': device_now,
'time': tombstone_time, 'time': tombstone_time,
'file': tombstone_file, 'file': tombstone_file,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment