diff options
author | Kevin Lim <ktlim@umich.edu> | 2006-07-12 15:25:34 -0400 |
---|---|---|
committer | Kevin Lim <ktlim@umich.edu> | 2006-07-12 15:25:34 -0400 |
commit | bbfe1db6b3d96e5bbf8fe91a494cf60eceae68ad (patch) | |
tree | 499a7693074aa4c78c239cdbe52f202c6f6e0814 /src/python | |
parent | 6d120b7912e554aaa44e28d1133f4bbfd9d04f66 (diff) | |
parent | bf4fdbe25a275eeb036cd5e9e05d126c52f90aba (diff) | |
download | gem5-bbfe1db6b3d96e5bbf8fe91a494cf60eceae68ad.tar.xz |
Merge ktlim@zizzer:/bk/newmem
into zamp.eecs.umich.edu:/z/ktlim2/clean/newmem
src/cpu/o3/fetch_impl.hh:
Hand merge.
--HG--
extra : convert_revision : 820dab2bc921cbadecaca51cd069327f984f5c74
Diffstat (limited to 'src/python')
-rw-r--r-- | src/python/m5/main.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/python/m5/main.py b/src/python/m5/main.py index 904b241ca..54c54c1d5 100644 --- a/src/python/m5/main.py +++ b/src/python/m5/main.py @@ -119,6 +119,8 @@ add_option('-d', "--outdir", metavar="DIR", default=".", help="Set the output directory to DIR [Default: %default]") add_option('-i', "--interactive", action="store_true", default=False, help="Invoke the interactive interpreter after running the script") +add_option("--pdb", action="store_true", default=False, + help="Invoke the python debugger before running the script") add_option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', help="Prepend PATH to the system path when invoking the script") add_option('-q', "--quiet", action="count", default=0, @@ -283,11 +285,23 @@ def main(): objects.ExecutionTrace.print_fetchseq = options.print_fetch_seq objects.ExecutionTrace.print_cpseq = options.print_cpseq - scope = { '__file__' : sys.argv[0] } sys.argv = arguments sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path - exec("import readline", scope) - execfile(sys.argv[0], scope) + + scope = { '__file__' : sys.argv[0] } + + # we want readline if we're doing anything interactive + if options.interactive or options.pdb: + exec("import readline", scope) + + # if pdb was requested, execfile the thing under pdb, otherwise, + # just do the execfile normally + if options.pdb: + from pdb import Pdb + debugger = Pdb() + debugger.run('execfile("%s")' % sys.argv[0], scope) + else: + execfile(sys.argv[0], scope) # once the script is done if options.interactive: |