Merge "stack: add support for a .zip of symbols." am: b4e31bbdd2 am: 9c72cdd915

Original change: https://android-review.googlesource.com/c/platform/development/+/1822144

Change-Id: I2f81d36e76deecd07d2a0ed45ed7a5412458ef21
This commit is contained in:
Elliott Hughes
2021-09-13 21:45:21 +00:00
committed by Automerger Merge Worker

View File

@@ -17,7 +17,11 @@
"""stack symbolizes native crash dumps."""
import argparse
import atexit
import glob
import sys
import tempfile
import zipfile
import stack_core
import symbol
@@ -25,7 +29,9 @@ import symbol
def main():
parser = argparse.ArgumentParser(description='Parse and symbolize crashes')
parser.add_argument('--arch', help='the target architecture')
parser.add_argument('--syms', '--symdir', help='the symbols directory')
group = parser.add_mutually_exclusive_group()
group.add_argument('--symbols-dir', '--syms', '--symdir', help='the symbols directory')
group.add_argument('--symbols-zip', help='the symbols.zip file from a build')
parser.add_argument('file',
metavar='FILE',
default='-',
@@ -36,11 +42,16 @@ def main():
'or if file is -, it reads from stdin.')
args = parser.parse_args()
if args.arch:
symbol.ARCH = args.arch
if args.syms:
symbol.SYMBOLS_DIR = args.syms
if args.symbols_dir:
symbol.SYMBOLS_DIR = args.symbols_dir
if args.symbols_zip:
tmp = tempfile.TemporaryDirectory()
atexit.register(tmp.cleanup)
with zipfile.ZipFile(args.symbols_zip) as zf:
zf.extractall(tmp.name)
symbol.SYMBOLS_DIR = glob.glob("%s/out/target/product/*/symbols" % tmp.name)[0]
if args.file == '-':
print("Reading native crash info from stdin")
f = sys.stdin