main.py (2891:85ce5705650b) main.py (2899:d0df86790961)
1# Copyright (c) 2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 105 unchanged lines hidden (view full) ---

114add_option('-N', "--release-notes", action="store_true", default=False,
115 help="Show the release notes")
116
117# Options for configuring the base simulator
118add_option('-d', "--outdir", metavar="DIR", default=".",
119 help="Set the output directory to DIR [Default: %default]")
120add_option('-i', "--interactive", action="store_true", default=False,
121 help="Invoke the interactive interpreter after running the script")
1# Copyright (c) 2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 105 unchanged lines hidden (view full) ---

114add_option('-N', "--release-notes", action="store_true", default=False,
115 help="Show the release notes")
116
117# Options for configuring the base simulator
118add_option('-d', "--outdir", metavar="DIR", default=".",
119 help="Set the output directory to DIR [Default: %default]")
120add_option('-i', "--interactive", action="store_true", default=False,
121 help="Invoke the interactive interpreter after running the script")
122add_option("--pdb", action="store_true", default=False,
123 help="Invoke the python debugger before running the script")
122add_option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':',
123 help="Prepend PATH to the system path when invoking the script")
124add_option('-q', "--quiet", action="count", default=0,
125 help="Reduce verbosity")
126add_option('-v', "--verbose", action="count", default=0,
127 help="Increase verbosity")
128
129# Statistics options

--- 152 unchanged lines hidden (view full) ---

282 objects.ExecutionTrace.print_iregs = options.print_iregs
283 objects.ExecutionTrace.print_fetchseq = options.print_fetch_seq
284 objects.ExecutionTrace.print_cpseq = options.print_cpseq
285
286 sys.argv = arguments
287 sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path
288
289 scope = { '__file__' : sys.argv[0] }
124add_option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':',
125 help="Prepend PATH to the system path when invoking the script")
126add_option('-q', "--quiet", action="count", default=0,
127 help="Reduce verbosity")
128add_option('-v', "--verbose", action="count", default=0,
129 help="Increase verbosity")
130
131# Statistics options

--- 152 unchanged lines hidden (view full) ---

284 objects.ExecutionTrace.print_iregs = options.print_iregs
285 objects.ExecutionTrace.print_fetchseq = options.print_fetch_seq
286 objects.ExecutionTrace.print_cpseq = options.print_cpseq
287
288 sys.argv = arguments
289 sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path
290
291 scope = { '__file__' : sys.argv[0] }
290 exec("import readline", scope)
291 execfile(sys.argv[0], scope)
292
292
293 # we want readline if we're doing anything interactive
294 if options.interactive or options.pdb:
295 exec("import readline", scope)
296
297 # if pdb was requested, execfile the thing under pdb, otherwise,
298 # just do the execfile normally
299 if options.pdb:
300 from pdb import Pdb
301 debugger = Pdb()
302 debugger.run('execfile("%s")' % sys.argv[0], scope)
303 else:
304 execfile(sys.argv[0], scope)
305
293 # once the script is done
294 if options.interactive:
295 interact = code.InteractiveConsole(scope)
296 interact.interact("M5 Interactive Console")
297
298if __name__ == '__main__':
299 from pprint import pprint
300
301 parse_args()
302
303 print 'opts:'
304 pprint(options, indent=4)
305 print
306
307 print 'args:'
308 pprint(arguments, indent=4)
306 # once the script is done
307 if options.interactive:
308 interact = code.InteractiveConsole(scope)
309 interact.interact("M5 Interactive Console")
310
311if __name__ == '__main__':
312 from pprint import pprint
313
314 parse_args()
315
316 print 'opts:'
317 pprint(options, indent=4)
318 print
319
320 print 'args:'
321 pprint(arguments, indent=4)