Merge changes Ibe0c93c6,Ib7b1de46
am: 458206d64e
Change-Id: I61603149f390c38a0926c2096a33eface5709f11
This commit is contained in:
@@ -16,55 +16,36 @@
|
|||||||
|
|
||||||
"""stack symbolizes native crash dumps."""
|
"""stack symbolizes native crash dumps."""
|
||||||
|
|
||||||
import getopt
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import stack_core
|
import stack_core
|
||||||
import symbol
|
import symbol
|
||||||
|
|
||||||
|
|
||||||
def PrintUsage():
|
|
||||||
"""Print usage and exit with error."""
|
|
||||||
# pylint: disable-msg=C6310
|
|
||||||
print
|
|
||||||
print " usage: " + sys.argv[0] + " [options] [FILE]"
|
|
||||||
print
|
|
||||||
print " --arch=arm|arm64|mips|mips64|x86|x86_64"
|
|
||||||
print " the target architecture"
|
|
||||||
print
|
|
||||||
print " FILE should contain a stack trace in it somewhere"
|
|
||||||
print " the tool will find that and re-print it with"
|
|
||||||
print " source files and line numbers. If you don't"
|
|
||||||
print " pass FILE, or if file is -, it reads from"
|
|
||||||
print " stdin."
|
|
||||||
print
|
|
||||||
# pylint: enable-msg=C6310
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
parser = argparse.ArgumentParser(description='Parse and symbolize crashes')
|
||||||
options, arguments = getopt.getopt(sys.argv[1:], "",
|
parser.add_argument('--arch', help='the target architecture')
|
||||||
["arch=",
|
parser.add_argument('--syms', '--symdir', help='the symbols directory')
|
||||||
"help"])
|
parser.add_argument('file',
|
||||||
except getopt.GetoptError, unused_error:
|
metavar='FILE',
|
||||||
PrintUsage()
|
default='-',
|
||||||
|
help='should contain a stack trace in it somewhere the '
|
||||||
|
'tool will find that and re-print it with source '
|
||||||
|
'files and line numbers. If you don\'t pass FILE, '
|
||||||
|
'or if file is -, it reads from stdin.')
|
||||||
|
|
||||||
for option, value in options:
|
args = parser.parse_args()
|
||||||
if option == "--help":
|
|
||||||
PrintUsage()
|
|
||||||
elif option == "--arch":
|
|
||||||
symbol.ARCH = value
|
|
||||||
|
|
||||||
if len(arguments) > 1:
|
if args.arch:
|
||||||
PrintUsage()
|
symbol.ARCH = args.arch
|
||||||
|
if args.syms:
|
||||||
if not arguments or arguments[0] == "-":
|
symbol.SYMBOLS_DIR = args.syms
|
||||||
|
if args.file == '-':
|
||||||
print "Reading native crash info from stdin"
|
print "Reading native crash info from stdin"
|
||||||
f = sys.stdin
|
f = sys.stdin
|
||||||
else:
|
else:
|
||||||
print "Searching for native crashes in %s" % arguments[0]
|
print "Searching for native crashes in %s" % args.file
|
||||||
f = open(arguments[0], "r")
|
f = open(args.file, "r")
|
||||||
|
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
f.close()
|
f.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user