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 --- 20 unchanged lines hidden (view full) --- 29import code 30import datetime 31import os 32import socket 33import sys 34 35from util import attrdict 36import config |
37from options import OptionParser |
38 39__all__ = [ 'options', 'arguments', 'main' ] 40 41def print_list(items, indent=4): 42 line = ' ' * indent 43 for i,item in enumerate(items): 44 if len(line) + len(item) > 76: 45 print line --- 79 unchanged lines hidden (view full) --- 125 help="Ignore EXPR sim objects") 126 127# Help options 128set_group("Help Options") 129add_option("--list-sim-objects", action='store_true', default=False, 130 help="List all built-in SimObjects, their parameters and default values") 131 132def main(): |
133 import event 134 import info 135 import internal 136 137 # load the options.py config file to allow people to set their own 138 # default options 139 options_file = config.get('options.py') 140 if options_file: --- 27 unchanged lines hidden (view full) --- 168 169 if options.redirect_stderr: 170 redir_fd = os.open(stderr_file, os. O_WRONLY | os.O_CREAT | os.O_TRUNC) 171 os.dup2(redir_fd, sys.stderr.fileno()) 172 173 done = False 174 175 if options.build_info: |
176 import defines 177 |
178 done = True 179 print 'Build information:' 180 print 181 print 'compiled %s' % internal.core.cvar.compileDate; 182 print "revision %s" % internal.core.cvar.hgRev 183 print "commit date %s" % internal.core.cvar.hgDate 184 print 'build options:' 185 keys = defines.m5_build_env.keys() --- 25 unchanged lines hidden (view full) --- 211 if options.release_notes: 212 done = True 213 print 'Release Notes:' 214 print 215 print info.RELEASE_NOTES 216 print 217 218 if options.trace_help: |
219 import traceflags 220 |
221 done = True 222 print "Base Flags:" 223 print_list(traceflags.baseFlags, indent=4) 224 print 225 print "Compound Flags:" 226 for flag in traceflags.compoundFlags: 227 if flag == 'All': 228 continue --- 64 unchanged lines hidden (view full) --- 293 # set stats options 294 internal.stats.initText(options.stats_file) 295 296 # set debugging options 297 internal.debug.setRemoteGDBPort(options.remote_gdb_port) 298 for when in options.debug_break: 299 internal.debug.schedBreakCycle(int(when)) 300 |
301 if options.trace_flags: 302 import traceflags |
303 |
304 on_flags = [] 305 off_flags = [] 306 for flag in options.trace_flags: 307 off = False 308 if flag.startswith('-'): 309 flag = flag[1:] 310 off = True 311 if flag not in traceflags.allFlags: 312 print >>sys.stderr, "invalid trace flag '%s'" % flag 313 sys.exit(1) |
314 |
315 if off: 316 off_flags.append(flag) 317 else: 318 on_flags.append(flag) |
319 |
320 for flag in on_flags: 321 internal.trace.set(flag) |
322 |
323 for flag in off_flags: 324 internal.trace.clear(flag) 325 |
326 if options.trace_start: 327 def enable_trace(): 328 internal.trace.cvar.enabled = True 329 event.create(enable_trace, int(options.trace_start)) 330 else: 331 internal.trace.cvar.enabled = True 332 333 internal.trace.output(options.trace_file) --- 23 unchanged lines hidden (view full) --- 357 # once the script is done 358 if options.interactive: 359 interact = code.InteractiveConsole(scope) 360 interact.interact("M5 Interactive Console") 361 362if __name__ == '__main__': 363 from pprint import pprint 364 |
365 # load the options.py config file to allow people to set their own 366 # default options 367 options_file = config.get('options.py') 368 if options_file: 369 scope = { 'options' : options } 370 execfile(options_file, scope) |
371 |
372 arguments = options.parse_args() 373 |
374 print 'opts:' 375 pprint(options, indent=4) 376 print 377 378 print 'args:' 379 pprint(arguments, indent=4) |