Index: tools/telemetry/telemetry/core/chrome/android_browser_backend.py |
diff --git a/tools/telemetry/telemetry/core/chrome/android_browser_backend.py b/tools/telemetry/telemetry/core/chrome/android_browser_backend.py |
index d80614c490905b879e1f8a35be5b635ee29b9773..c9381e00c98aac98cb955274f4a6e9eb6c4da1c2 100644 |
--- a/tools/telemetry/telemetry/core/chrome/android_browser_backend.py |
+++ b/tools/telemetry/telemetry/core/chrome/android_browser_backend.py |
@@ -6,7 +6,6 @@ import logging |
import os |
import subprocess |
import sys |
-import tempfile |
import time |
from telemetry.core import exceptions |
@@ -261,31 +260,31 @@ class AndroidBrowserBackend(browser_backend.BrowserBackend): |
return local_port |
def GetStandardOutput(self): |
- # If we can find symbols and there is a stack, output the symbolized stack. |
- symbol_paths = [ |
- os.path.join(adb_commands.GetOutDirectory(), 'Release', 'lib'), |
- os.path.join(adb_commands.GetOutDirectory(), 'Debug', 'lib'), |
- os.path.join(adb_commands.GetOutDirectory(), 'Release', 'lib.target'), |
- os.path.join(adb_commands.GetOutDirectory(), 'Debug', 'lib.target')] |
- for symbol_path in symbol_paths: |
- if not os.path.isdir(symbol_path): |
- continue |
- with tempfile.NamedTemporaryFile() as f: |
- lines = self._adb.RunShellCommand('logcat -d') |
- for line in lines: |
- f.write(line + '\n') |
- symbolized_stack = None |
- try: |
- logging.info('Symbolizing stack...') |
- symbolized_stack = subprocess.Popen([ |
- 'ndk-stack', '-sym', symbol_path, |
- '-dump', f.name], stdout=subprocess.PIPE).communicate()[0] |
- except Exception: |
- pass |
- if symbolized_stack: |
- return symbolized_stack |
- # Otherwise, just return the last 100 lines of logcat. |
- return '\n'.join(self._adb.RunShellCommand('logcat -d -t 100')) |
+ def Decorate(title, content): |
+ return title + '\n' + content + '\n' + '*' * 80 + '\n' |
+ # Get the last lines of logcat (large enough to contain stacktrace) |
+ logcat = '\n'.join(self._adb.RunShellCommand('logcat -d -t 500')) |
+ ret = Decorate('Logcat', logcat) |
+ chrome_src_dir = os.path.abspath( |
tonyg
2013/07/12 15:33:30
util.GetChromiumSrcDir()
bulach
2013/07/12 15:51:27
much nicer! thanks.
|
+ os.path.join(os.path.dirname(__file__), |
+ '..', '..', '..', '..', '..')) |
+ stack = os.path.join(chrome_src_dir, 'third_party', 'android_platform', |
+ 'development', 'scripts', 'stack') |
+ # Try to symbolize logcat. |
+ if os.path.exists(stack): |
+ p = subprocess.Popen([stack], stdin=subprocess.PIPE, |
+ stdout=subprocess.PIPE) |
+ ret += Decorate('Stack from Logcat', p.communicate(input=logcat)[0]) |
+ |
+ # Try to get tombstones. |
+ tombstones = os.path.join(chrome_src_dir, 'build', 'android', |
+ 'tombstones.py') |
+ if os.path.exists(tombstones): |
+ ret += Decorate('Tombstones', |
+ subprocess.Popen([tombstones, '-w', '--device', |
+ self._adb.device()], |
+ stdout=subprocess.PIPE).communicate()[0]) |
+ return ret |
def CreateForwarder(self, *port_pairs): |
return adb_commands.Forwarder(self._adb, *port_pairs) |