Fix tools/android_stack_parser/stack and use it in skydb

This adds a skydb print_crash command which will dump the
symbolicated stack trace of all crashes found in adb logcat
output from the android device.

R=qsr@chromium.org

Review URL: https://codereview.chromium.org/787803006
This commit is contained in:
Eric Seidel 2015-01-13 15:03:49 -08:00
parent d8f1313e81
commit 211b09bc3b

View File

@ -3,7 +3,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import skypy.paths
from skypy.skyserver import SkyServer
import argparse
import json
@ -12,6 +11,8 @@ import os
import pipes
import requests
import signal
import skypy.paths
import StringIO
import subprocess
import sys
import time
@ -318,7 +319,7 @@ class SkyDebugger(object):
'MojoShellApplication',
'chromium',
]
subprocess.call(['adb', 'logcat', '-s'] + TAGS)
subprocess.call(['adb', 'logcat', '-d', '-s'] + TAGS)
def gdb_attach_command(self, args):
self.paths = self._create_paths_for_build_dir(self.pids['build_dir'])
@ -331,6 +332,16 @@ class SkyDebugger(object):
# gdb and let it take the entire process.
os.execv(gdb_command[0], gdb_command)
def print_crash_command(self, args):
logcat_cmd = ['adb', 'logcat', '-d']
logcat = subprocess.Popen(logcat_cmd, stdout=subprocess.PIPE)
stack_path = os.path.join(SRC_ROOT,
'tools', 'android_stack_parser', 'stack')
stack = subprocess.Popen([stack_path, '-'], stdin=logcat.stdout)
logcat.wait()
stack.wait()
def main(self):
logging.basicConfig(level=logging.INFO)
logging.getLogger("requests").setLevel(logging.WARNING)
@ -362,6 +373,10 @@ class SkyDebugger(object):
help=('dump sky-related logs from device'))
logcat_parser.set_defaults(func=self.logcat_command)
print_crash_parser = subparsers.add_parser('print_crash',
help=('dump (and symbolicate) recent crash-stacks'))
print_crash_parser.set_defaults(func=self.print_crash_command)
gdb_attach_parser = subparsers.add_parser('gdb_attach',
help='launch gdb and attach to gdbserver launched from start --gdb')
gdb_attach_parser.set_defaults(func=self.gdb_attach_command)