Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1194)

Unified Diff: build/android/tombstones.py

Issue 446273003: [Android]: Fix tombstones.py architecture detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Sami's comments. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/tombstones.py
diff --git a/build/android/tombstones.py b/build/android/tombstones.py
index ebe1bf8bebe56b52ad7ccf990f47d2dafb638d0b..fd060ad5175f4ede192ade78ab4b15696051ccbb 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,17 +77,36 @@ 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
+ raise RuntimeError('Unknown device ABI: %s' % device_abi)
+
+def _ResolveSymbols(tombstone_data, include_stack, device_abi):
"""Run the stack tool for given tombstone input.
Args:
tombstone_data: a list of strings of tombstone data.
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:
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__), '..', '..',
'third_party', 'android_platform', 'development',
'scripts', 'stack')
@@ -108,7 +128,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 +173,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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698