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 --- 16 unchanged lines hidden (view full) --- 25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26# 27# Authors: Nathan Binkert 28 29import code, optparse, os, socket, sys 30from datetime import datetime 31from attrdict import attrdict 32 |
33__all__ = [ 'options', 'arguments', 'main' ] 34 35usage="%prog [m5 options] script.py [script options]" 36version="%prog 2.0" 37brief_copyright=''' 38Copyright (c) 2001-2006 39The Regents of The University of Michigan 40All Rights Reserved --- 93 unchanged lines hidden (view full) --- 134 help="Cycle to create a breakpoint") 135 136# Tracing options 137set_group("Trace Options") 138add_option("--trace-flags", metavar="FLAG[,FLAG]", action='append', split=',', 139 help="Sets the flags for tracing") 140add_option("--trace-start", metavar="TIME", default='0s', 141 help="Start tracing at TIME (must have units)") |
142add_option("--trace-file", metavar="FILE", default="cout", 143 help="Sets the output file for tracing [Default: %default]") 144add_option("--trace-circlebuf", metavar="SIZE", type="int", default=0, 145 help="If SIZE is non-zero, turn on the circular buffer with SIZE lines") 146add_option("--no-trace-circlebuf", action="store_const", const=0, 147 dest='trace_circlebuf', help=optparse.SUPPRESS_HELP) 148bool_option("trace-dumponexit", default=False, 149 help="Dump trace buffer on exit") --- 49 unchanged lines hidden (view full) --- 199 200 del opts.quiet 201 202 options.update(opts) 203 arguments.extend(args) 204 return opts,args 205 206def main(): |
207 import defines 208 import info |
209 import internal 210 211 parse_args() 212 213 done = False 214 if options.copyright: 215 done = True 216 print info.LICENSE --- 51 unchanged lines hidden (view full) --- 268 269 # set stats options 270 objects.Statistics.text_file = options.stats_file 271 272 # set debugging options 273 for when in options.debug_break: 274 internal.debug.schedBreakCycle(int(when)) 275 |
276 for flag in options.trace_flags: 277 internal.trace.setFlag(flag) |
278 |
279 if options.trace_start is not None: 280 internal.trace.enabled = False 281 def enable_trace(): 282 internal.event.enabled = True 283 internal.event.create(enable_trace, options.trace_start) 284 285 if options.trace_file is not None: 286 internal.trace.file(options.trace_file) 287 288 if options.trace_bufsize is not None: 289 internal.trace.buffer_size(options.bufsize) 290 291 #if options.trace_dumponexit: 292 # internal.trace.dumpOnExit = True 293 294 for ignore in options.trace_ignore: 295 internal.trace.ignore(ignore) 296 |
297 # set execution trace options 298 objects.ExecutionTrace.speculative = options.speculative 299 objects.ExecutionTrace.print_cycle = options.print_cycle 300 objects.ExecutionTrace.pc_symbol = options.print_symbol 301 objects.ExecutionTrace.print_opclass = options.print_opclass 302 objects.ExecutionTrace.print_thread = options.print_thread 303 objects.ExecutionTrace.print_effaddr = options.print_effaddr 304 objects.ExecutionTrace.print_data = options.print_data --- 6 unchanged lines hidden (view full) --- 311 sys.argv = arguments 312 sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path 313 314 scope = { '__file__' : sys.argv[0], 315 '__name__' : '__m5_main__' } 316 317 # we want readline if we're doing anything interactive 318 if options.interactive or options.pdb: |
319 exec "import readline" in scope |
320 321 # if pdb was requested, execfile the thing under pdb, otherwise, 322 # just do the execfile normally 323 if options.pdb: 324 from pdb import Pdb 325 debugger = Pdb() 326 debugger.run('execfile("%s")' % sys.argv[0], scope) 327 else: --- 18 unchanged lines hidden --- |