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 9import optparse 10import subprocess 11import sys 12 13parser = optparse.OptionParser() 14parser.description = __doc__ 15parser.add_option('-e', '--executable', help='path to obj_int_extract.') 16parser.add_option('-f', '--format', help='binary format (gas or rvds).') 17parser.add_option('-b', '--binary', help='path to binary to parse.') 18parser.add_option('-o', '--output', help='path to write extracted output to.') 19 20 21options, args = parser.parse_args() 22if (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 27with open(options.output, 'w') as fh: 28 subprocess.check_call([options.executable, options.format, options.binary], 29 stdout=fh) 30 31sys.exit(0) 32