main.py revision 13670
12810SN/A# Copyright (c) 2016 ARM Limited 29614Srene.dejong@arm.com# All rights reserved. 38856Sandreas.hansson@arm.com# 48856Sandreas.hansson@arm.com# The license below extends only to copyright in the software and shall 58856Sandreas.hansson@arm.com# not be construed as granting a license to any other intellectual 68856Sandreas.hansson@arm.com# property including but not limited to intellectual property relating 78856Sandreas.hansson@arm.com# to a hardware implementation of the functionality of the software 88856Sandreas.hansson@arm.com# licensed hereunder. You may use the software subject to the license 98856Sandreas.hansson@arm.com# terms below provided that you ensure that this notice is replicated 108856Sandreas.hansson@arm.com# unmodified and in its entirety in all distributions of the software, 118856Sandreas.hansson@arm.com# modified or unmodified, in source code or in binary form. 128856Sandreas.hansson@arm.com# 138856Sandreas.hansson@arm.com# Copyright (c) 2005 The Regents of The University of Michigan 142810SN/A# All rights reserved. 152810SN/A# 162810SN/A# Redistribution and use in source and binary forms, with or without 172810SN/A# modification, are permitted provided that the following conditions are 182810SN/A# met: redistributions of source code must retain the above copyright 192810SN/A# notice, this list of conditions and the following disclaimer; 202810SN/A# redistributions in binary form must reproduce the above copyright 212810SN/A# notice, this list of conditions and the following disclaimer in the 222810SN/A# documentation and/or other materials provided with the distribution; 232810SN/A# neither the name of the copyright holders nor the names of its 242810SN/A# contributors may be used to endorse or promote products derived from 252810SN/A# this software without specific prior written permission. 262810SN/A# 272810SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 282810SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 292810SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 302810SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 312810SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 322810SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 332810SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 342810SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 352810SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 362810SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 372810SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 382810SN/A# 392810SN/A# Authors: Nathan Binkert 402810SN/A 412810SN/Afrom __future__ import print_function 422810SN/A 432810SN/Aimport code 442810SN/Aimport datetime 452810SN/Aimport os 462810SN/Aimport socket 472810SN/Aimport sys 488232Snate@binkert.org 499152Satgutier@umich.edu__all__ = [ 'options', 'arguments', 'main' ] 509795Sandreas.hansson@arm.com 519795Sandreas.hansson@arm.comusage="%prog [gem5 options] script.py [script options]" 5210263Satgutier@umich.eduversion="%prog 2.0" 535338Sstever@gmail.combrief_copyright=\ 549795Sandreas.hansson@arm.com "gem5 is copyrighted software; use the --copyright option for details." 555338Sstever@gmail.com 568786Sgblack@eecs.umich.edudef parse_options(): 572810SN/A import config 582810SN/A from options import OptionParser 592810SN/A 608856Sandreas.hansson@arm.com options = OptionParser(usage=usage, version=version, 618856Sandreas.hansson@arm.com description=brief_copyright) 628856Sandreas.hansson@arm.com option = options.add_option 638922Swilliam.wang@arm.com group = options.set_group 648914Sandreas.hansson@arm.com 658856Sandreas.hansson@arm.com listener_modes = ( "on", "off", "auto" ) 668856Sandreas.hansson@arm.com 674475SN/A # Help options 685034SN/A option('-B', "--build-info", action="store_true", default=False, 695034SN/A help="Show build information") 7010360Sandreas.hansson@arm.com option('-C', "--copyright", action="store_true", default=False, 7110622Smitch.hayenga@arm.com help="Show full copyright information") 7210622Smitch.hayenga@arm.com option('-R', "--readme", action="store_true", default=False, 734628SN/A help="Show the readme") 749814Sandreas.hansson@arm.com 759263Smrinmoy.ghosh@arm.com # Options for configuring the base simulator 769263Smrinmoy.ghosh@arm.com option('-d', "--outdir", metavar="DIR", default="m5out", 775034SN/A help="Set the output directory to DIR [Default: %default]") 786122SSteve.Reinhardt@amd.com option('-r', "--redirect-stdout", action="store_true", default=False, 798134SAli.Saidi@ARM.com help="Redirect stdout (& stderr, without -e) to file") 804626SN/A option('-e', "--redirect-stderr", action="store_true", default=False, 8110360Sandreas.hansson@arm.com help="Redirect stderr to file") 824626SN/A option("--stdout-file", metavar="FILE", default="simout", 835034SN/A help="Filename for -r redirection [Default: %default]") 848883SAli.Saidi@ARM.com option("--stderr-file", metavar="FILE", default="simerr", 858833Sdam.sunwoo@arm.com help="Filename for -e redirection [Default: %default]") 864458SN/A option("--listener-mode", metavar="{on,off,auto}", 872810SN/A choices=listener_modes, default="auto", 882810SN/A help="Port (e.g., gdb) listener mode (auto: Enable if running " \ 893013SN/A "interactively) [Default: %default]") 908856Sandreas.hansson@arm.com option("--listener-loopback-only", action="store_true", default=False, 912810SN/A help="Port listeners will only accept connections over the " \ 923013SN/A "loopback device") 938856Sandreas.hansson@arm.com option('-i', "--interactive", action="store_true", default=False, 942810SN/A help="Invoke the interactive interpreter after running the script") 959614Srene.dejong@arm.com option("--pdb", action="store_true", default=False, 969614Srene.dejong@arm.com help="Invoke the python debugger before running the script") 979614Srene.dejong@arm.com option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', 9810345SCurtis.Dunham@arm.com help="Prepend PATH to the system path when invoking the script") 9910345SCurtis.Dunham@arm.com option('-q', "--quiet", action="count", default=0, 10010345SCurtis.Dunham@arm.com help="Reduce verbosity") 1019614Srene.dejong@arm.com option('-v', "--verbose", action="count", default=0, 1022810SN/A help="Increase verbosity") 1032810SN/A 1042810SN/A # Statistics options 1058856Sandreas.hansson@arm.com group("Statistics Options") 1062810SN/A option("--stats-file", metavar="FILE", default="stats.txt", 1073013SN/A help="Sets the output file for statistics [Default: %default]") 1088856Sandreas.hansson@arm.com 1093013SN/A # Configuration Options 1108856Sandreas.hansson@arm.com group("Configuration Options") 1114666SN/A option("--dump-config", metavar="FILE", default="config.ini", 1128922Swilliam.wang@arm.com help="Dump configuration output file [Default: %default]") 1132897SN/A option("--json-config", metavar="FILE", default="config.json", 1142810SN/A help="Create JSON output of the configuration [Default: %default]") 1152810SN/A option("--dot-config", metavar="FILE", default="config.dot", 11610344Sandreas.hansson@arm.com help="Create DOT & pdf outputs of the configuration [Default: %default]") 11710344Sandreas.hansson@arm.com option("--dot-dvfs-config", metavar="FILE", default=None, 11810344Sandreas.hansson@arm.com help="Create DOT & pdf outputs of the DVFS configuration" + \ 11910344Sandreas.hansson@arm.com " [Default: %default]") 12010344Sandreas.hansson@arm.com 12110344Sandreas.hansson@arm.com # Debugging options 12210344Sandreas.hansson@arm.com group("Debugging Options") 12310344Sandreas.hansson@arm.com option("--debug-break", metavar="TICK[,TICK]", action='append', split=',', 12410344Sandreas.hansson@arm.com help="Create breakpoint(s) at TICK(s) " \ 1252844SN/A "(kills process if no debugger attached)") 1262810SN/A option("--debug-help", action='store_true', 1272858SN/A help="Print help on debug flags") 1282858SN/A option("--debug-flags", metavar="FLAG[,FLAG]", action='append', split=',', 1298856Sandreas.hansson@arm.com help="Sets the flags for debug output (-FLAG disables a flag)") 1308922Swilliam.wang@arm.com option("--debug-start", metavar="TICK", type='int', 1318711Sandreas.hansson@arm.com help="Start debug output at TICK") 1322858SN/A option("--debug-end", metavar="TICK", type='int', 1332858SN/A help="End debug output at TICK") 1349294Sandreas.hansson@arm.com option("--debug-file", metavar="FILE", default="cout", 1359294Sandreas.hansson@arm.com help="Sets the output file for debug [Default: %default]") 1368922Swilliam.wang@arm.com option("--debug-ignore", metavar="EXPR", action='append', split=':', 1378922Swilliam.wang@arm.com help="Ignore EXPR sim objects") 1388922Swilliam.wang@arm.com option("--remote-gdb-port", type='int', default=7000, 1398922Swilliam.wang@arm.com help="Remote gdb base port (set to 0 to disable listening)") 1408922Swilliam.wang@arm.com 1418922Swilliam.wang@arm.com # Help options 1428922Swilliam.wang@arm.com group("Help Options") 1438922Swilliam.wang@arm.com option("--list-sim-objects", action='store_true', default=False, 1449294Sandreas.hansson@arm.com help="List all built-in SimObjects, their params and default values") 1459294Sandreas.hansson@arm.com 1468922Swilliam.wang@arm.com # load the options.py config file to allow people to set their own 1478922Swilliam.wang@arm.com # default options 1488922Swilliam.wang@arm.com options_file = config.get('options.py') 1498922Swilliam.wang@arm.com if options_file: 1508922Swilliam.wang@arm.com scope = { 'options' : options } 1518922Swilliam.wang@arm.com execfile(options_file, scope) 1528922Swilliam.wang@arm.com 1534628SN/A arguments = options.parse_args() 1542858SN/A return options,arguments 1552810SN/A 1562810SN/Adef interact(scope): 1572810SN/A banner = "gem5 Interactive Console" 1582810SN/A 1592810SN/A ipshell = None 1604022SN/A prompt_in1 = "gem5 \\#> " 1614022SN/A prompt_out = "gem5 \\#: " 1624022SN/A 1632810SN/A # Is IPython version 0.10 or earlier available? 1642810SN/A try: 1658833Sdam.sunwoo@arm.com from IPython.Shell import IPShellEmbed 1662810SN/A ipshell = IPShellEmbed(argv=["-prompt_in1", prompt_in1, 1672810SN/A "-prompt_out", prompt_out], 1682810SN/A banner=banner, user_ns=scope) 1692810SN/A except ImportError: 1708833Sdam.sunwoo@arm.com pass 1718833Sdam.sunwoo@arm.com 1728833Sdam.sunwoo@arm.com # Is IPython version 0.11 or later available? 1732810SN/A if not ipshell: 1742810SN/A try: 1754871SN/A import IPython 1764871SN/A from IPython.config.loader import Config 1774871SN/A from IPython.terminal.embed import InteractiveShellEmbed 1784871SN/A 1794871SN/A cfg = Config() 1804871SN/A cfg.PromptManager.in_template = prompt_in1 1814871SN/A cfg.PromptManager.out_template = prompt_out 1824871SN/A ipshell = InteractiveShellEmbed(config=cfg, user_ns=scope, 1834871SN/A banner1=banner) 1844871SN/A except ImportError: 1852810SN/A pass 1862810SN/A 1872810SN/A if ipshell: 1888833Sdam.sunwoo@arm.com ipshell() 1892810SN/A else: 1904871SN/A # Use the Python shell in the standard library if IPython 1918833Sdam.sunwoo@arm.com # isn't available. 1928833Sdam.sunwoo@arm.com code.InteractiveConsole(scope).interact(banner) 1938833Sdam.sunwoo@arm.com 1942810SN/Adef main(*args): 1952810SN/A import m5 1962810SN/A 1972810SN/A import core 1988833Sdam.sunwoo@arm.com import debug 1992810SN/A import defines 2004871SN/A import event 2018833Sdam.sunwoo@arm.com import info 2028833Sdam.sunwoo@arm.com import stats 2038833Sdam.sunwoo@arm.com import trace 2042810SN/A 2052810SN/A from util import inform, fatal, panic, isInteractive 2064022SN/A 2074022SN/A if len(args) == 0: 2084022SN/A options, arguments = parse_options() 2092810SN/A elif len(args) == 2: 2102810SN/A options, arguments = args 2118833Sdam.sunwoo@arm.com else: 2122810SN/A raise TypeError("main() takes 0 or 2 arguments (%d given)" % len(args)) 2132810SN/A 2142810SN/A m5.options = options 2152810SN/A 2168833Sdam.sunwoo@arm.com def check_tracing(): 2178833Sdam.sunwoo@arm.com if defines.TRACING_ON: 2188833Sdam.sunwoo@arm.com return 2192810SN/A 2202810SN/A fatal("Tracing is not enabled. Compile with TRACING_ON") 2212810SN/A 2222810SN/A # Set the main event queue for the main thread. 2232810SN/A event.mainq = event.getEventQueue(0) 2248833Sdam.sunwoo@arm.com event.setEventQueue(event.mainq) 2252810SN/A 2264871SN/A if not os.path.isdir(options.outdir): 2278833Sdam.sunwoo@arm.com os.makedirs(options.outdir) 2288833Sdam.sunwoo@arm.com 2298833Sdam.sunwoo@arm.com # These filenames are used only if the redirect_std* options are set 2302810SN/A stdout_file = os.path.join(options.outdir, options.stdout_file) 2312810SN/A stderr_file = os.path.join(options.outdir, options.stderr_file) 2322810SN/A 2332810SN/A # Print redirection notices here before doing any redirection 2348833Sdam.sunwoo@arm.com if options.redirect_stdout and not options.redirect_stderr: 2352810SN/A print("Redirecting stdout and stderr to", stdout_file) 2364871SN/A else: 2378833Sdam.sunwoo@arm.com if options.redirect_stdout: 2388833Sdam.sunwoo@arm.com print("Redirecting stdout to", stdout_file) 2398833Sdam.sunwoo@arm.com if options.redirect_stderr: 2402810SN/A print("Redirecting stderr to", stderr_file) 2412810SN/A 2424022SN/A # Now redirect stdout/stderr as desired 2434022SN/A if options.redirect_stdout: 2444022SN/A redir_fd = os.open(stdout_file, os. O_WRONLY | os.O_CREAT | os.O_TRUNC) 2452810SN/A os.dup2(redir_fd, sys.stdout.fileno()) 2462810SN/A if not options.redirect_stderr: 2478833Sdam.sunwoo@arm.com os.dup2(redir_fd, sys.stderr.fileno()) 2482810SN/A 2492810SN/A if options.redirect_stderr: 2502810SN/A redir_fd = os.open(stderr_file, os. O_WRONLY | os.O_CREAT | os.O_TRUNC) 2512810SN/A os.dup2(redir_fd, sys.stderr.fileno()) 2528833Sdam.sunwoo@arm.com 2538833Sdam.sunwoo@arm.com done = False 2548833Sdam.sunwoo@arm.com 2552810SN/A if options.build_info: 2562810SN/A done = True 2572810SN/A print('Build information:') 2582810SN/A print() 2592810SN/A print('compiled %s' % defines.compileDate) 2608833Sdam.sunwoo@arm.com print('build options:') 2612810SN/A keys = defines.buildEnv.keys() 2624871SN/A keys.sort() 2638833Sdam.sunwoo@arm.com for key in keys: 2648833Sdam.sunwoo@arm.com val = defines.buildEnv[key] 2658833Sdam.sunwoo@arm.com print(' %s = %s' % (key, val)) 2662810SN/A print() 2672810SN/A 2682810SN/A if options.copyright: 2692810SN/A done = True 2708833Sdam.sunwoo@arm.com print(info.COPYING) 2712810SN/A print() 2724871SN/A 2738833Sdam.sunwoo@arm.com if options.readme: 2748833Sdam.sunwoo@arm.com done = True 2758833Sdam.sunwoo@arm.com print('Readme:') 2762810SN/A print() 2772810SN/A print(info.README) 2784022SN/A print() 2794022SN/A 2804022SN/A if options.debug_help: 2812810SN/A done = True 2822810SN/A check_tracing() 2832810SN/A debug.help() 2842810SN/A 2852810SN/A if options.list_sim_objects: 2862810SN/A import SimObject 2878833Sdam.sunwoo@arm.com done = True 2882810SN/A print("SimObjects:") 2898833Sdam.sunwoo@arm.com objects = SimObject.allClasses.keys() 2908833Sdam.sunwoo@arm.com objects.sort() 2918833Sdam.sunwoo@arm.com for name in objects: 2922810SN/A obj = SimObject.allClasses[name] 2932810SN/A print(" %s" % obj) 2942810SN/A params = obj._params.keys() 2952810SN/A params.sort() 2962810SN/A for pname in params: 2978833Sdam.sunwoo@arm.com param = obj._params[pname] 2982810SN/A default = getattr(param, 'default', '') 2992810SN/A print(" %s" % pname) 3008833Sdam.sunwoo@arm.com if default: 3018833Sdam.sunwoo@arm.com print(" default: %s" % default) 3028833Sdam.sunwoo@arm.com print(" desc: %s" % param.desc) 3032810SN/A print() 3042810SN/A print() 3052810SN/A 3062810SN/A if done: 3078833Sdam.sunwoo@arm.com sys.exit(0) 3082810SN/A 3092810SN/A # setting verbose and quiet at the same time doesn't make sense 3108833Sdam.sunwoo@arm.com if options.verbose > 0 and options.quiet > 0: 3118833Sdam.sunwoo@arm.com options.usage(2) 3128833Sdam.sunwoo@arm.com 3132810SN/A verbose = options.verbose - options.quiet 3142810SN/A if verbose >= 0: 3154022SN/A print("gem5 Simulator System. http://gem5.org") 3164022SN/A print(brief_copyright) 3174022SN/A print() 3182810SN/A 3192810SN/A print("gem5 compiled %s" % defines.compileDate) 3202810SN/A 3212810SN/A print("gem5 started %s" % 3222810SN/A datetime.datetime.now().strftime("%b %e %Y %X")) 3232810SN/A print("gem5 executing on %s, pid %d" % 3248833Sdam.sunwoo@arm.com (socket.gethostname(), os.getpid())) 3252810SN/A 3268833Sdam.sunwoo@arm.com # in Python 3 pipes.quote() is moved to shlex.quote() 3278833Sdam.sunwoo@arm.com import pipes 3288833Sdam.sunwoo@arm.com print("command line:", " ".join(map(pipes.quote, sys.argv))) 3292810SN/A print() 3302810SN/A 3312810SN/A # check to make sure we can find the listed script 3322810SN/A if not arguments or not os.path.isfile(arguments[0]): 3332810SN/A if arguments and not os.path.isfile(arguments[0]): 3348833Sdam.sunwoo@arm.com print("Script %s not found" % arguments[0]) 3352810SN/A 3362810SN/A options.usage(2) 3378833Sdam.sunwoo@arm.com 3388833Sdam.sunwoo@arm.com # tell C++ about output directory 3398833Sdam.sunwoo@arm.com core.setOutputDir(options.outdir) 3402810SN/A 3412810SN/A # update the system path with elements from the -p option 3422810SN/A sys.path[0:0] = options.path 3432810SN/A 3448833Sdam.sunwoo@arm.com # set stats options 3452810SN/A stats.addStatVisitor(options.stats_file) 3462810SN/A 3478833Sdam.sunwoo@arm.com # Disable listeners unless running interactively or explicitly 3488833Sdam.sunwoo@arm.com # enabled 3498833Sdam.sunwoo@arm.com if options.listener_mode == "off": 3502810SN/A m5.disableAllListeners() 3512810SN/A elif options.listener_mode == "auto": 3524022SN/A if not isInteractive(): 3534022SN/A inform("Standard input is not a terminal, disabling listeners.") 3544022SN/A m5.disableAllListeners() 3552810SN/A elif options.listener_mode == "on": 3562810SN/A pass 3572810SN/A else: 3582810SN/A panic("Unhandled listener mode: %s" % options.listener_mode) 3592810SN/A 3602810SN/A if options.listener_loopback_only: 3612810SN/A m5.listenersLoopbackOnly() 3622810SN/A 3638833Sdam.sunwoo@arm.com # set debugging options 3648833Sdam.sunwoo@arm.com debug.setRemoteGDBPort(options.remote_gdb_port) 3658833Sdam.sunwoo@arm.com for when in options.debug_break: 3668833Sdam.sunwoo@arm.com debug.schedBreak(int(when)) 3672810SN/A 3682810SN/A if options.debug_flags: 3692810SN/A check_tracing() 3702810SN/A 3712810SN/A on_flags = [] 3728833Sdam.sunwoo@arm.com off_flags = [] 3732810SN/A for flag in options.debug_flags: 3742810SN/A off = False 3758833Sdam.sunwoo@arm.com if flag.startswith('-'): 3768833Sdam.sunwoo@arm.com flag = flag[1:] 3778833Sdam.sunwoo@arm.com off = True 3782810SN/A 3792810SN/A if flag not in debug.flags: 3802810SN/A print("invalid debug flag '%s'" % flag, file=sys.stderr) 3812810SN/A sys.exit(1) 3828833Sdam.sunwoo@arm.com 3832810SN/A if off: 3842810SN/A debug.flags[flag].disable() 3858833Sdam.sunwoo@arm.com else: 3868833Sdam.sunwoo@arm.com debug.flags[flag].enable() 3878833Sdam.sunwoo@arm.com 3882810SN/A if options.debug_start: 3892810SN/A check_tracing() 3902810SN/A e = event.create(trace.enable, event.Event.Debug_Enable_Pri) 3912810SN/A event.mainq.schedule(e, options.debug_start) 3922810SN/A else: 3932810SN/A trace.enable() 3942810SN/A 3952810SN/A if options.debug_end: 3962810SN/A check_tracing() 3972810SN/A e = event.create(trace.disable, event.Event.Debug_Enable_Pri) 3982810SN/A event.mainq.schedule(e, options.debug_end) 3992810SN/A 4002810SN/A trace.output(options.debug_file) 4012810SN/A 4022810SN/A for ignore in options.debug_ignore: 4032810SN/A check_tracing() 4042810SN/A trace.ignore(ignore) 4052810SN/A 4062810SN/A sys.argv = arguments 4072810SN/A sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path 4082810SN/A 4092810SN/A filename = sys.argv[0] 4102810SN/A filedata = open(filename, 'r').read() 4112810SN/A filecode = compile(filedata, filename, 'exec') 4122810SN/A scope = { '__file__' : filename, 4132810SN/A '__name__' : '__m5_main__' } 4142810SN/A 4152810SN/A # if pdb was requested, execfile the thing under pdb, otherwise, 4162810SN/A # just do the execfile normally 4172810SN/A if options.pdb: 4182810SN/A import pdb 4192810SN/A import traceback 4202810SN/A 4212810SN/A pdb = pdb.Pdb() 4222810SN/A try: 4232810SN/A pdb.run(filecode, scope) 4242826SN/A except SystemExit: 4254626SN/A print("The program exited via sys.exit(). Exit status: ", end=' ') 4268833Sdam.sunwoo@arm.com print(sys.exc_info()[1]) 4274626SN/A except: 4284626SN/A traceback.print_exc() 4298833Sdam.sunwoo@arm.com print("Uncaught exception. Entering post mortem debugging") 4304626SN/A t = sys.exc_info()[2] 4318833Sdam.sunwoo@arm.com while t.tb_next is not None: 4328833Sdam.sunwoo@arm.com t = t.tb_next 4338833Sdam.sunwoo@arm.com pdb.interaction(t.tb_frame,t) 4344626SN/A else: 4354626SN/A exec filecode in scope 4364626SN/A 4374626SN/A # once the script is done 4384626SN/A if options.interactive: 4394626SN/A interact(scope) 4404626SN/A 4414626SN/Aif __name__ == '__main__': 4428833Sdam.sunwoo@arm.com from pprint import pprint 4434626SN/A 4444626SN/A options, arguments = parse_options() 4454626SN/A 4464626SN/A print('opts:') 4478833Sdam.sunwoo@arm.com pprint(options, indent=4) 4488833Sdam.sunwoo@arm.com print() 4498833Sdam.sunwoo@arm.com 4504626SN/A print('args:') 4514626SN/A pprint(arguments, indent=4) 4524626SN/A