stack: add support for a .zip of symbols.
This is the one remaining feature in vendor/google/tools/stack that isn't in the "One True" stack script. Bug: http://b/199390145 Test: manual Change-Id: I9dd832f6fb5767c3ad3263c1ffc7dfdb0103e535
This commit is contained in:
@@ -17,7 +17,11 @@
|
|||||||
"""stack symbolizes native crash dumps."""
|
"""stack symbolizes native crash dumps."""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import atexit
|
||||||
|
import glob
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import zipfile
|
||||||
|
|
||||||
import stack_core
|
import stack_core
|
||||||
import symbol
|
import symbol
|
||||||
@@ -25,7 +29,9 @@ import symbol
|
|||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Parse and symbolize crashes')
|
parser = argparse.ArgumentParser(description='Parse and symbolize crashes')
|
||||||
parser.add_argument('--arch', help='the target architecture')
|
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',
|
parser.add_argument('file',
|
||||||
metavar='FILE',
|
metavar='FILE',
|
||||||
default='-',
|
default='-',
|
||||||
@@ -36,11 +42,16 @@ def main():
|
|||||||
'or if file is -, it reads from stdin.')
|
'or if file is -, it reads from stdin.')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.arch:
|
if args.arch:
|
||||||
symbol.ARCH = args.arch
|
symbol.ARCH = args.arch
|
||||||
if args.syms:
|
if args.symbols_dir:
|
||||||
symbol.SYMBOLS_DIR = args.syms
|
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 == '-':
|
if args.file == '-':
|
||||||
print("Reading native crash info from stdin")
|
print("Reading native crash info from stdin")
|
||||||
f = sys.stdin
|
f = sys.stdin
|
||||||
|
|||||||
Reference in New Issue
Block a user