main.py revision 5524:e5fbd38bc828
112598Snikos.nikoleris@arm.com# Copyright (c) 2005 The Regents of The University of Michigan 27090SN/A# All rights reserved. 37090SN/A# 47090SN/A# Redistribution and use in source and binary forms, with or without 57090SN/A# modification, are permitted provided that the following conditions are 67090SN/A# met: redistributions of source code must retain the above copyright 77090SN/A# notice, this list of conditions and the following disclaimer; 87090SN/A# redistributions in binary form must reproduce the above copyright 97090SN/A# notice, this list of conditions and the following disclaimer in the 107090SN/A# documentation and/or other materials provided with the distribution; 117090SN/A# neither the name of the copyright holders nor the names of its 127090SN/A# contributors may be used to endorse or promote products derived from 134486SN/A# this software without specific prior written permission. 144486SN/A# 154486SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 164486SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 174486SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 184486SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 194486SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 204486SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 214486SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 224486SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 234486SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 244486SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 254486SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 264486SN/A# 274486SN/A# Authors: Nathan Binkert 284486SN/A 294486SN/Aimport code 304486SN/Aimport datetime 314486SN/Aimport os 324486SN/Aimport socket 334486SN/Aimport sys 344486SN/A 354486SN/Afrom util import attrdict 364486SN/Aimport config 374486SN/Aimport defines 384486SN/Afrom options import OptionParser 397584SAli.Saidi@arm.comimport traceflags 407584SAli.Saidi@arm.com 417754SWilliam.Wang@arm.com__all__ = [ 'options', 'arguments', 'main' ] 4212472Sglenn.bergmans@arm.com 434486SN/Adef print_list(items, indent=4): 4412472Sglenn.bergmans@arm.com line = ' ' * indent 453630SN/A for i,item in enumerate(items): 463630SN/A if len(line) + len(item) > 76: 4712472Sglenn.bergmans@arm.com print line 4811011SAndreas.Sandberg@ARM.com line = ' ' * indent 4911011SAndreas.Sandberg@ARM.com 507587SAli.Saidi@arm.com if i < len(items) - 1: 5111244Sandreas.sandberg@arm.com line += '%s, ' % item 5210353SGeoffrey.Blake@arm.com else: 538212SAli.Saidi@ARM.com line += item 545478SN/A print line 555478SN/A 567584SAli.Saidi@arm.comusage="%prog [m5 options] script.py [script options]" 578931Sandreas.hansson@arm.comversion="%prog 2.0" 589525SAndreas.Sandberg@ARM.combrief_copyright=''' 5910397Sstephan.diestelhorst@arm.comCopyright (c) 2001-2008 6012467SCurtis.Dunham@arm.comThe Regents of The University of Michigan 6111090Sandreas.sandberg@arm.comAll Rights Reserved 6211236Sandreas.sandberg@arm.com''' 6312232Sgiacomo.travaglini@arm.com 6412472Sglenn.bergmans@arm.comoptions = OptionParser(usage=usage, version=version, 653630SN/A description=brief_copyright) 6611841Sandreas.sandberg@arm.comadd_option = options.add_option 6711841Sandreas.sandberg@arm.comset_group = options.set_group 6811841Sandreas.sandberg@arm.comusage = options.usage 6911841Sandreas.sandberg@arm.com 7011841Sandreas.sandberg@arm.com# Help options 7111841Sandreas.sandberg@arm.comadd_option('-A', "--authors", action="store_true", default=False, 7211841Sandreas.sandberg@arm.com help="Show author information") 7311841Sandreas.sandberg@arm.comadd_option('-B', "--build-info", action="store_true", default=False, 7411841Sandreas.sandberg@arm.com help="Show build information") 7511841Sandreas.sandberg@arm.comadd_option('-C', "--copyright", action="store_true", default=False, 7611841Sandreas.sandberg@arm.com help="Show full copyright information") 7711841Sandreas.sandberg@arm.comadd_option('-R', "--readme", action="store_true", default=False, 789806Sstever@gmail.com help="Show the readme") 799806Sstever@gmail.comadd_option('-N', "--release-notes", action="store_true", default=False, 807584SAli.Saidi@arm.com help="Show the release notes") 819338SAndreas.Sandberg@arm.com 827584SAli.Saidi@arm.com# Options for configuring the base simulator 833898SN/Aadd_option('-d', "--outdir", metavar="DIR", default=".", 849806Sstever@gmail.com help="Set the output directory to DIR [Default: %default]") 857950SAli.Saidi@ARM.comadd_option('-r', "--redirect-stdout", action="store_true", default=False, 867950SAli.Saidi@ARM.com help="Redirect stdout (& stderr, without -e) to file") 879338SAndreas.Sandberg@arm.comadd_option('-e', "--redirect-stderr", action="store_true", default=False, 889525SAndreas.Sandberg@ARM.com help="Redirect stderr to file") 897950SAli.Saidi@ARM.comadd_option("--stdout-file", metavar="FILE", default="simout", 907950SAli.Saidi@ARM.com help="Filename for -r redirection [Default: %default]") 917950SAli.Saidi@ARM.comadd_option("--stderr-file", metavar="FILE", default="simerr", 927950SAli.Saidi@ARM.com help="Filename for -e redirection [Default: %default]") 937587SAli.Saidi@arm.comadd_option('-i', "--interactive", action="store_true", default=False, 947587SAli.Saidi@arm.com help="Invoke the interactive interpreter after running the script") 957587SAli.Saidi@arm.comadd_option("--pdb", action="store_true", default=False, 969338SAndreas.Sandberg@arm.com help="Invoke the python debugger before running the script") 977753SWilliam.Wang@arm.comadd_option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', 987753SWilliam.Wang@arm.com help="Prepend PATH to the system path when invoking the script") 999525SAndreas.Sandberg@ARM.comadd_option('-q', "--quiet", action="count", default=0, 1007753SWilliam.Wang@arm.com help="Reduce verbosity") 1017587SAli.Saidi@arm.comadd_option('-v', "--verbose", action="count", default=0, 1027587SAli.Saidi@arm.com help="Increase verbosity") 1038282SAli.Saidi@ARM.com 1048282SAli.Saidi@ARM.com# Statistics options 1059338SAndreas.Sandberg@arm.comset_group("Statistics Options") 1068282SAli.Saidi@ARM.comadd_option("--stats-file", metavar="FILE", default="m5stats.txt", 10711296Sandreas.sandberg@arm.com help="Sets the output file for statistics [Default: %default]") 10811296Sandreas.sandberg@arm.com 10911296Sandreas.sandberg@arm.com# Debugging options 11011296Sandreas.sandberg@arm.comset_group("Debugging Options") 11111296Sandreas.sandberg@arm.comadd_option("--debug-break", metavar="TIME[,TIME]", action='append', split=',', 11211296Sandreas.sandberg@arm.com help="Cycle to create a breakpoint") 11311296Sandreas.sandberg@arm.comadd_option("--remote-gdb-port", type='int', default=7000, 11411296Sandreas.sandberg@arm.com help="Remote gdb base port") 11511296Sandreas.sandberg@arm.com 11611296Sandreas.sandberg@arm.com# Tracing options 11711296Sandreas.sandberg@arm.comset_group("Trace Options") 11811296Sandreas.sandberg@arm.comadd_option("--trace-help", action='store_true', 11911296Sandreas.sandberg@arm.com help="Print help on trace flags") 12011296Sandreas.sandberg@arm.comadd_option("--trace-flags", metavar="FLAG[,FLAG]", action='append', split=',', 12112474Sglenn.bergmans@arm.com help="Sets the flags for tracing (-FLAG disables a flag)") 12212474Sglenn.bergmans@arm.comadd_option("--trace-start", metavar="TIME", type='int', 12312474Sglenn.bergmans@arm.com help="Start tracing at TIME (must be in ticks)") 12412474Sglenn.bergmans@arm.comadd_option("--trace-file", metavar="FILE", default="cout", 12512474Sglenn.bergmans@arm.com help="Sets the output file for tracing [Default: %default]") 12612474Sglenn.bergmans@arm.comadd_option("--trace-ignore", metavar="EXPR", action='append', split=':', 12712474Sglenn.bergmans@arm.com help="Ignore EXPR sim objects") 12812474Sglenn.bergmans@arm.com 12912474Sglenn.bergmans@arm.com# Help options 13012474Sglenn.bergmans@arm.comset_group("Help Options") 13112474Sglenn.bergmans@arm.comadd_option("--list-sim-objects", action='store_true', default=False, 13212474Sglenn.bergmans@arm.com help="List all built-in SimObjects, their parameters and default values") 13312474Sglenn.bergmans@arm.com 13412474Sglenn.bergmans@arm.comdef main(): 13512474Sglenn.bergmans@arm.com import defines 13612474Sglenn.bergmans@arm.com import event 13712474Sglenn.bergmans@arm.com import info 13812474Sglenn.bergmans@arm.com import internal 13912474Sglenn.bergmans@arm.com 14012474Sglenn.bergmans@arm.com # load the options.py config file to allow people to set their own 14112474Sglenn.bergmans@arm.com # default options 14212474Sglenn.bergmans@arm.com options_file = config.get('options.py') 14312474Sglenn.bergmans@arm.com if options_file: 14412474Sglenn.bergmans@arm.com scope = { 'options' : options } 14512474Sglenn.bergmans@arm.com execfile(options_file, scope) 14612474Sglenn.bergmans@arm.com 14712474Sglenn.bergmans@arm.com arguments = options.parse_args() 14812474Sglenn.bergmans@arm.com 14912474Sglenn.bergmans@arm.com if not os.path.isdir(options.outdir): 15012474Sglenn.bergmans@arm.com os.makedirs(options.outdir) 15112474Sglenn.bergmans@arm.com 15212474Sglenn.bergmans@arm.com # These filenames are used only if the redirect_std* options are set 15312474Sglenn.bergmans@arm.com stdout_file = os.path.join(options.outdir, options.stdout_file) 15412474Sglenn.bergmans@arm.com stderr_file = os.path.join(options.outdir, options.stderr_file) 15512474Sglenn.bergmans@arm.com 15612474Sglenn.bergmans@arm.com # Print redirection notices here before doing any redirection 15712474Sglenn.bergmans@arm.com if options.redirect_stdout and not options.redirect_stderr: 15812474Sglenn.bergmans@arm.com print "Redirecting stdout and stderr to", stdout_file 15912474Sglenn.bergmans@arm.com else: 16012474Sglenn.bergmans@arm.com if options.redirect_stdout: 16112474Sglenn.bergmans@arm.com print "Redirecting stdout to", stdout_file 16212474Sglenn.bergmans@arm.com if options.redirect_stderr: 16312474Sglenn.bergmans@arm.com print "Redirecting stderr to", stderr_file 16412474Sglenn.bergmans@arm.com 16512474Sglenn.bergmans@arm.com # Now redirect stdout/stderr as desired 16612474Sglenn.bergmans@arm.com if options.redirect_stdout: 16712474Sglenn.bergmans@arm.com redir_fd = os.open(stdout_file, os. O_WRONLY | os.O_CREAT | os.O_TRUNC) 16812474Sglenn.bergmans@arm.com os.dup2(redir_fd, sys.stdout.fileno()) 16912474Sglenn.bergmans@arm.com if not options.redirect_stderr: 17012474Sglenn.bergmans@arm.com os.dup2(redir_fd, sys.stderr.fileno()) 17112474Sglenn.bergmans@arm.com 17212474Sglenn.bergmans@arm.com if options.redirect_stderr: 17312474Sglenn.bergmans@arm.com redir_fd = os.open(stderr_file, os. O_WRONLY | os.O_CREAT | os.O_TRUNC) 17412474Sglenn.bergmans@arm.com os.dup2(redir_fd, sys.stderr.fileno()) 17512474Sglenn.bergmans@arm.com 17612474Sglenn.bergmans@arm.com done = False 17712474Sglenn.bergmans@arm.com 17812474Sglenn.bergmans@arm.com if options.build_info: 17912474Sglenn.bergmans@arm.com done = True 18012474Sglenn.bergmans@arm.com print 'Build information:' 18112474Sglenn.bergmans@arm.com print 18212474Sglenn.bergmans@arm.com print 'compiled %s' % internal.core.cvar.compileDate; 18312474Sglenn.bergmans@arm.com print 'started %s' % datetime.datetime.now().ctime() 18412474Sglenn.bergmans@arm.com print 'executing on %s' % socket.gethostname() 18512474Sglenn.bergmans@arm.com print 'build options:' 1867584SAli.Saidi@arm.com keys = defines.m5_build_env.keys() 1877584SAli.Saidi@arm.com keys.sort() 1889338SAndreas.Sandberg@arm.com for key in keys: 1898524SAli.Saidi@ARM.com val = defines.m5_build_env[key] 1908524SAli.Saidi@ARM.com print ' %s = %s' % (key, val) 1918299Schander.sudanthi@arm.com print 1927584SAli.Saidi@arm.com 19312472Sglenn.bergmans@arm.com if options.copyright: 19412472Sglenn.bergmans@arm.com done = True 19512472Sglenn.bergmans@arm.com print info.LICENSE 19612472Sglenn.bergmans@arm.com print 19712472Sglenn.bergmans@arm.com 19812472Sglenn.bergmans@arm.com if options.authors: 19912472Sglenn.bergmans@arm.com done = True 20012472Sglenn.bergmans@arm.com print 'Author information:' 20112472Sglenn.bergmans@arm.com print 20212472Sglenn.bergmans@arm.com print info.AUTHORS 20312472Sglenn.bergmans@arm.com print 20412472Sglenn.bergmans@arm.com 20511011SAndreas.Sandberg@ARM.com if options.readme: 20611011SAndreas.Sandberg@ARM.com done = True 20711011SAndreas.Sandberg@ARM.com print 'Readme:' 20811011SAndreas.Sandberg@ARM.com print 20911011SAndreas.Sandberg@ARM.com print info.README 21011011SAndreas.Sandberg@ARM.com print 21111011SAndreas.Sandberg@ARM.com 21211011SAndreas.Sandberg@ARM.com if options.release_notes: 21311011SAndreas.Sandberg@ARM.com done = True 21411011SAndreas.Sandberg@ARM.com print 'Release Notes:' 21511011SAndreas.Sandberg@ARM.com print 21611011SAndreas.Sandberg@ARM.com print info.RELEASE_NOTES 21711011SAndreas.Sandberg@ARM.com print 21811011SAndreas.Sandberg@ARM.com 21911011SAndreas.Sandberg@ARM.com if options.trace_help: 22011011SAndreas.Sandberg@ARM.com done = True 22111011SAndreas.Sandberg@ARM.com print "Base Flags:" 22211011SAndreas.Sandberg@ARM.com print_list(traceflags.baseFlags, indent=4) 22311011SAndreas.Sandberg@ARM.com print 22411011SAndreas.Sandberg@ARM.com print "Compound Flags:" 22511011SAndreas.Sandberg@ARM.com for flag in traceflags.compoundFlags: 22611011SAndreas.Sandberg@ARM.com if flag == 'All': 22712472Sglenn.bergmans@arm.com continue 22812472Sglenn.bergmans@arm.com print " %s:" % flag 22912472Sglenn.bergmans@arm.com print_list(traceflags.compoundFlagMap[flag], indent=8) 23012472Sglenn.bergmans@arm.com print 23112472Sglenn.bergmans@arm.com 23212472Sglenn.bergmans@arm.com if options.list_sim_objects: 23312472Sglenn.bergmans@arm.com import SimObject 23412472Sglenn.bergmans@arm.com done = True 23512472Sglenn.bergmans@arm.com print "SimObjects:" 23612472Sglenn.bergmans@arm.com objects = SimObject.allClasses.keys() 23712472Sglenn.bergmans@arm.com objects.sort() 23812472Sglenn.bergmans@arm.com for name in objects: 23912472Sglenn.bergmans@arm.com obj = SimObject.allClasses[name] 24012472Sglenn.bergmans@arm.com print " %s" % obj 24111421Sdavid.guillen@arm.com params = obj._params.keys() 24211421Sdavid.guillen@arm.com params.sort() 24311421Sdavid.guillen@arm.com for pname in params: 24411421Sdavid.guillen@arm.com param = obj._params[pname] 24511421Sdavid.guillen@arm.com default = getattr(param, 'default', '') 24611421Sdavid.guillen@arm.com print " %s" % pname 24711421Sdavid.guillen@arm.com if default: 24811421Sdavid.guillen@arm.com print " default: %s" % default 24911421Sdavid.guillen@arm.com print " desc: %s" % param.desc 25011421Sdavid.guillen@arm.com print 25111421Sdavid.guillen@arm.com print 25211421Sdavid.guillen@arm.com 25311421Sdavid.guillen@arm.com if done: 25411421Sdavid.guillen@arm.com sys.exit(0) 25511421Sdavid.guillen@arm.com 25611421Sdavid.guillen@arm.com # setting verbose and quiet at the same time doesn't make sense 25711236Sandreas.sandberg@arm.com if options.verbose > 0 and options.quiet > 0: 25811236Sandreas.sandberg@arm.com options.usage(2) 25911236Sandreas.sandberg@arm.com 26011236Sandreas.sandberg@arm.com verbose = options.verbose - options.quiet 26111236Sandreas.sandberg@arm.com if options.verbose >= 0: 26211236Sandreas.sandberg@arm.com print "M5 Simulator System" 26311236Sandreas.sandberg@arm.com print brief_copyright 26411236Sandreas.sandberg@arm.com print 26511236Sandreas.sandberg@arm.com print "M5 compiled %s" % internal.core.cvar.compileDate; 26611011SAndreas.Sandberg@ARM.com print "M5 started %s" % datetime.datetime.now().ctime() 26711011SAndreas.Sandberg@ARM.com print "M5 executing on %s" % socket.gethostname() 26811421Sdavid.guillen@arm.com 26911421Sdavid.guillen@arm.com print "M5 revision %s" % internal.core.cvar.hgRev 27011421Sdavid.guillen@arm.com print "M5 commit date %s" % internal.core.cvar.hgDate 27111236Sandreas.sandberg@arm.com 27211236Sandreas.sandberg@arm.com print "command line:", 27311236Sandreas.sandberg@arm.com for argv in sys.argv: 27411236Sandreas.sandberg@arm.com print argv, 27511236Sandreas.sandberg@arm.com print 27611421Sdavid.guillen@arm.com 27711421Sdavid.guillen@arm.com # check to make sure we can find the listed script 27811421Sdavid.guillen@arm.com if not arguments or not os.path.isfile(arguments[0]): 27912472Sglenn.bergmans@arm.com if arguments and not os.path.isfile(arguments[0]): 28012472Sglenn.bergmans@arm.com print "Script %s not found" % arguments[0] 28112472Sglenn.bergmans@arm.com 28212472Sglenn.bergmans@arm.com options.usage(2) 28312472Sglenn.bergmans@arm.com 28412472Sglenn.bergmans@arm.com # tell C++ about output directory 28512472Sglenn.bergmans@arm.com internal.core.setOutputDir(options.outdir) 28612472Sglenn.bergmans@arm.com 28712472Sglenn.bergmans@arm.com # update the system path with elements from the -p option 28812472Sglenn.bergmans@arm.com sys.path[0:0] = options.path 28912472Sglenn.bergmans@arm.com 29012472Sglenn.bergmans@arm.com import objects 29112472Sglenn.bergmans@arm.com 29212472Sglenn.bergmans@arm.com # set stats options 29311236Sandreas.sandberg@arm.com internal.stats.initText(options.stats_file) 29411236Sandreas.sandberg@arm.com 29511236Sandreas.sandberg@arm.com # set debugging options 29611236Sandreas.sandberg@arm.com internal.debug.setRemoteGDBPort(options.remote_gdb_port) 29711236Sandreas.sandberg@arm.com for when in options.debug_break: 29811236Sandreas.sandberg@arm.com internal.debug.schedBreakCycle(int(when)) 29911236Sandreas.sandberg@arm.com 30011236Sandreas.sandberg@arm.com on_flags = [] 30111236Sandreas.sandberg@arm.com off_flags = [] 30211011SAndreas.Sandberg@ARM.com for flag in options.trace_flags: 30311011SAndreas.Sandberg@ARM.com off = False 30411236Sandreas.sandberg@arm.com if flag.startswith('-'): 30511236Sandreas.sandberg@arm.com flag = flag[1:] 30611236Sandreas.sandberg@arm.com off = True 30711236Sandreas.sandberg@arm.com if flag not in traceflags.allFlags: 30811236Sandreas.sandberg@arm.com print >>sys.stderr, "invalid trace flag '%s'" % flag 30911236Sandreas.sandberg@arm.com sys.exit(1) 31011236Sandreas.sandberg@arm.com 31111011SAndreas.Sandberg@ARM.com if off: 31212472Sglenn.bergmans@arm.com off_flags.append(flag) 31312472Sglenn.bergmans@arm.com else: 31412472Sglenn.bergmans@arm.com on_flags.append(flag) 31512472Sglenn.bergmans@arm.com 31612472Sglenn.bergmans@arm.com for flag in on_flags: 31712472Sglenn.bergmans@arm.com internal.trace.set(flag) 31812472Sglenn.bergmans@arm.com 31912472Sglenn.bergmans@arm.com for flag in off_flags: 32012472Sglenn.bergmans@arm.com internal.trace.clear(flag) 32112472Sglenn.bergmans@arm.com 32212472Sglenn.bergmans@arm.com if options.trace_start: 32312472Sglenn.bergmans@arm.com def enable_trace(): 32412472Sglenn.bergmans@arm.com internal.trace.cvar.enabled = True 32510037SARM gem5 Developers event.create(enable_trace, int(options.trace_start)) 32610037SARM gem5 Developers else: 32710037SARM gem5 Developers internal.trace.cvar.enabled = True 32810037SARM gem5 Developers 32910037SARM gem5 Developers internal.trace.output(options.trace_file) 33010037SARM gem5 Developers 33110037SARM gem5 Developers for ignore in options.trace_ignore: 33210037SARM gem5 Developers internal.trace.ignore(ignore) 33310037SARM gem5 Developers 33410037SARM gem5 Developers sys.argv = arguments 33510037SARM gem5 Developers sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path 33612472Sglenn.bergmans@arm.com 33712472Sglenn.bergmans@arm.com scope = { '__file__' : sys.argv[0], 33812472Sglenn.bergmans@arm.com '__name__' : '__m5_main__' } 33912472Sglenn.bergmans@arm.com 34012472Sglenn.bergmans@arm.com # we want readline if we're doing anything interactive 34112472Sglenn.bergmans@arm.com if options.interactive or options.pdb: 34212472Sglenn.bergmans@arm.com exec "import readline" in scope 34312472Sglenn.bergmans@arm.com 34412472Sglenn.bergmans@arm.com # if pdb was requested, execfile the thing under pdb, otherwise, 34512472Sglenn.bergmans@arm.com # just do the execfile normally 34612472Sglenn.bergmans@arm.com if options.pdb: 34712472Sglenn.bergmans@arm.com from pdb import Pdb 34812472Sglenn.bergmans@arm.com debugger = Pdb() 34912472Sglenn.bergmans@arm.com debugger.run('execfile("%s")' % sys.argv[0], scope) 35012472Sglenn.bergmans@arm.com else: 35112472Sglenn.bergmans@arm.com execfile(sys.argv[0], scope) 35212472Sglenn.bergmans@arm.com 35312472Sglenn.bergmans@arm.com # once the script is done 35412472Sglenn.bergmans@arm.com if options.interactive: 35512472Sglenn.bergmans@arm.com interact = code.InteractiveConsole(scope) 35612472Sglenn.bergmans@arm.com interact.interact("M5 Interactive Console") 35712472Sglenn.bergmans@arm.com 35812472Sglenn.bergmans@arm.comif __name__ == '__main__': 35912472Sglenn.bergmans@arm.com from pprint import pprint 36012472Sglenn.bergmans@arm.com 36112472Sglenn.bergmans@arm.com parse_args() 36212472Sglenn.bergmans@arm.com 36312472Sglenn.bergmans@arm.com print 'opts:' 3649806Sstever@gmail.com pprint(options, indent=4) 3657584SAli.Saidi@arm.com print 3669338SAndreas.Sandberg@arm.com 3677584SAli.Saidi@arm.com print 'args:' 3687584SAli.Saidi@arm.com pprint(arguments, indent=4) 3697584SAli.Saidi@arm.com