1 #!/usr/bin/python 2 # 3 # Copyright 2014 The Chromium Authors. All rights reserved. 4 # Use of this source code is governed by a BSD-style license that can be 5 # found in the LICENSE file. 6 7 "This script is used to run obj_int_extract and output the result to a file." 8 9 import optparse 10 import subprocess 11 import sys 12 13 parser = optparse.OptionParser() 14 parser.description = __doc__ 15 parser.add_option('-e', '--executable', help='path to obj_int_extract.') 16 parser.add_option('-f', '--format', help='binary format (gas or rvds).') 17 parser.add_option('-b', '--binary', help='path to binary to parse.') 18 parser.add_option('-o', '--output', help='path to write extracted output to.') 19 20 21 options, args = parser.parse_args() 22 if (not options.executable or not options.format or not options.binary or 23 not options.output): 24 parser.error('Must specify all four arguments.') 25 sys.exit(1) 26 27 with open(options.output, 'w') as fh: 28 subprocess.check_call([options.executable, options.format, options.binary], 29 stdout=fh) 30 31 sys.exit(0) 32