Index: build/android/tombstones.py |
diff --git a/build/android/tombstones.py b/build/android/tombstones.py |
index 3c1624bab263567f10f0289d679fede824acf70d..97d9602de344fc420518be9b0a183d57f6a51ddc 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 |
@@ -52,6 +53,21 @@ def _GetDeviceDateTime(device): |
device_now_string[0], '%a %b %d %H:%M:%S %Z %Y') |
+def _GetDeviceArch(device): |
jbudorick
2014/07/25 14:19:02
This function isn't needed.
|
+ """Get CPU architecture of the device. |
+ |
+ Args: |
+ device: An instance of DeviceUtils. |
+ |
+ Returns: |
+ CPU architecture string. |
+ """ |
+ lines = device.RunShellCommand('getprop') |
+ for line in lines: |
+ if 'ro.product.cpu.abi' in line: |
+ return re.sub('[\[\]]', '', line.split(':')[1].strip()) |
+ |
+ |
def _GetTombstoneData(device, tombstone_file): |
"""Retrieve the tombstone data from the device |
@@ -76,7 +92,7 @@ def _EraseTombstone(device, tombstone_file): |
'rm /data/tombstones/' + tombstone_file, as_root=True) |
-def _ResolveSymbols(tombstone_data, include_stack): |
+def _ResolveSymbols(tombstone_data, include_stack, arch): |
"""Run the stack tool for given tombstone input. |
Args: |
@@ -89,7 +105,7 @@ def _ResolveSymbols(tombstone_data, include_stack): |
stack_tool = os.path.join(os.path.dirname(__file__), '..', '..', |
'third_party', 'android_platform', 'development', |
'scripts', 'stack') |
- proc = subprocess.Popen(stack_tool, stdin=subprocess.PIPE, |
+ proc = subprocess.Popen([stack_tool, '--arch', arch], stdin=subprocess.PIPE, |
stdout=subprocess.PIPE) |
output = proc.communicate(input='\n'.join(tombstone_data))[0] |
for line in output.split('\n'): |
@@ -106,7 +122,8 @@ def _ResolveTombstone(tombstone): |
' Device: ' + tombstone['serial'])] |
print '\n'.join(lines) |
print 'Resolving...' |
- lines += _ResolveSymbols(tombstone['data'], tombstone['stack']) |
+ lines += _ResolveSymbols(tombstone['data'], tombstone['stack'], |
+ tombstone['arch']) |
return lines |
@@ -151,6 +168,7 @@ def _GetTombstonesForDevice(device, options): |
device_now = _GetDeviceDateTime(device) |
for tombstone_file, tombstone_time in tombstones: |
ret += [{'serial': str(device), |
+ 'arch': _GetDeviceArch(device), |
jbudorick
2014/07/25 14:19:02
_GetDeviceArch(device)
should be replaced by
d
|
'device_now': device_now, |
'time': tombstone_time, |
'file': tombstone_file, |
@@ -164,6 +182,7 @@ def _GetTombstonesForDevice(device, options): |
return ret |
+ |
def main(): |
parser = optparse.OptionParser() |
parser.add_option('--device', |