main.py (13670:8a98db5a481f) | main.py (13671:b288ca1bcae8) |
---|---|
1# Copyright (c) 2016 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 134 unchanged lines hidden (view full) --- 143 option("--list-sim-objects", action='store_true', default=False, 144 help="List all built-in SimObjects, their params and default values") 145 146 # load the options.py config file to allow people to set their own 147 # default options 148 options_file = config.get('options.py') 149 if options_file: 150 scope = { 'options' : options } | 1# Copyright (c) 2016 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 134 unchanged lines hidden (view full) --- 143 option("--list-sim-objects", action='store_true', default=False, 144 help="List all built-in SimObjects, their params and default values") 145 146 # load the options.py config file to allow people to set their own 147 # default options 148 options_file = config.get('options.py') 149 if options_file: 150 scope = { 'options' : options } |
151 execfile(options_file, scope) | 151 exec(compile(open(options_file).read(), options_file, 'exec'), scope) |
152 153 arguments = options.parse_args() 154 return options,arguments 155 156def interact(scope): 157 banner = "gem5 Interactive Console" 158 159 ipshell = None --- 26 unchanged lines hidden (view full) --- 186 187 if ipshell: 188 ipshell() 189 else: 190 # Use the Python shell in the standard library if IPython 191 # isn't available. 192 code.InteractiveConsole(scope).interact(banner) 193 | 152 153 arguments = options.parse_args() 154 return options,arguments 155 156def interact(scope): 157 banner = "gem5 Interactive Console" 158 159 ipshell = None --- 26 unchanged lines hidden (view full) --- 186 187 if ipshell: 188 ipshell() 189 else: 190 # Use the Python shell in the standard library if IPython 191 # isn't available. 192 code.InteractiveConsole(scope).interact(banner) 193 |
194 195def _check_tracing(): 196 if defines.TRACING_ON: 197 return 198 199 fatal("Tracing is not enabled. Compile with TRACING_ON") 200 |
|
194def main(*args): 195 import m5 196 197 import core 198 import debug 199 import defines 200 import event 201 import info --- 6 unchanged lines hidden (view full) --- 208 options, arguments = parse_options() 209 elif len(args) == 2: 210 options, arguments = args 211 else: 212 raise TypeError("main() takes 0 or 2 arguments (%d given)" % len(args)) 213 214 m5.options = options 215 | 201def main(*args): 202 import m5 203 204 import core 205 import debug 206 import defines 207 import event 208 import info --- 6 unchanged lines hidden (view full) --- 215 options, arguments = parse_options() 216 elif len(args) == 2: 217 options, arguments = args 218 else: 219 raise TypeError("main() takes 0 or 2 arguments (%d given)" % len(args)) 220 221 m5.options = options 222 |
216 def check_tracing(): 217 if defines.TRACING_ON: 218 return 219 220 fatal("Tracing is not enabled. Compile with TRACING_ON") 221 | |
222 # Set the main event queue for the main thread. 223 event.mainq = event.getEventQueue(0) 224 event.setEventQueue(event.mainq) 225 226 if not os.path.isdir(options.outdir): 227 os.makedirs(options.outdir) 228 229 # These filenames are used only if the redirect_std* options are set --- 44 unchanged lines hidden (view full) --- 274 done = True 275 print('Readme:') 276 print() 277 print(info.README) 278 print() 279 280 if options.debug_help: 281 done = True | 223 # Set the main event queue for the main thread. 224 event.mainq = event.getEventQueue(0) 225 event.setEventQueue(event.mainq) 226 227 if not os.path.isdir(options.outdir): 228 os.makedirs(options.outdir) 229 230 # These filenames are used only if the redirect_std* options are set --- 44 unchanged lines hidden (view full) --- 275 done = True 276 print('Readme:') 277 print() 278 print(info.README) 279 print() 280 281 if options.debug_help: 282 done = True |
282 check_tracing() | 283 _check_tracing() |
283 debug.help() 284 285 if options.list_sim_objects: 286 import SimObject 287 done = True 288 print("SimObjects:") 289 objects = SimObject.allClasses.keys() 290 objects.sort() --- 70 unchanged lines hidden (view full) --- 361 m5.listenersLoopbackOnly() 362 363 # set debugging options 364 debug.setRemoteGDBPort(options.remote_gdb_port) 365 for when in options.debug_break: 366 debug.schedBreak(int(when)) 367 368 if options.debug_flags: | 284 debug.help() 285 286 if options.list_sim_objects: 287 import SimObject 288 done = True 289 print("SimObjects:") 290 objects = SimObject.allClasses.keys() 291 objects.sort() --- 70 unchanged lines hidden (view full) --- 362 m5.listenersLoopbackOnly() 363 364 # set debugging options 365 debug.setRemoteGDBPort(options.remote_gdb_port) 366 for when in options.debug_break: 367 debug.schedBreak(int(when)) 368 369 if options.debug_flags: |
369 check_tracing() | 370 _check_tracing() |
370 371 on_flags = [] 372 off_flags = [] 373 for flag in options.debug_flags: 374 off = False 375 if flag.startswith('-'): 376 flag = flag[1:] 377 off = True 378 379 if flag not in debug.flags: 380 print("invalid debug flag '%s'" % flag, file=sys.stderr) 381 sys.exit(1) 382 383 if off: 384 debug.flags[flag].disable() 385 else: 386 debug.flags[flag].enable() 387 388 if options.debug_start: | 371 372 on_flags = [] 373 off_flags = [] 374 for flag in options.debug_flags: 375 off = False 376 if flag.startswith('-'): 377 flag = flag[1:] 378 off = True 379 380 if flag not in debug.flags: 381 print("invalid debug flag '%s'" % flag, file=sys.stderr) 382 sys.exit(1) 383 384 if off: 385 debug.flags[flag].disable() 386 else: 387 debug.flags[flag].enable() 388 389 if options.debug_start: |
389 check_tracing() | 390 _check_tracing() |
390 e = event.create(trace.enable, event.Event.Debug_Enable_Pri) 391 event.mainq.schedule(e, options.debug_start) 392 else: 393 trace.enable() 394 395 if options.debug_end: | 391 e = event.create(trace.enable, event.Event.Debug_Enable_Pri) 392 event.mainq.schedule(e, options.debug_start) 393 else: 394 trace.enable() 395 396 if options.debug_end: |
396 check_tracing() | 397 _check_tracing() |
397 e = event.create(trace.disable, event.Event.Debug_Enable_Pri) 398 event.mainq.schedule(e, options.debug_end) 399 400 trace.output(options.debug_file) 401 402 for ignore in options.debug_ignore: | 398 e = event.create(trace.disable, event.Event.Debug_Enable_Pri) 399 event.mainq.schedule(e, options.debug_end) 400 401 trace.output(options.debug_file) 402 403 for ignore in options.debug_ignore: |
403 check_tracing() | 404 _check_tracing() |
404 trace.ignore(ignore) 405 406 sys.argv = arguments 407 sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path 408 409 filename = sys.argv[0] 410 filedata = open(filename, 'r').read() 411 filecode = compile(filedata, filename, 'exec') --- 15 unchanged lines hidden (view full) --- 427 except: 428 traceback.print_exc() 429 print("Uncaught exception. Entering post mortem debugging") 430 t = sys.exc_info()[2] 431 while t.tb_next is not None: 432 t = t.tb_next 433 pdb.interaction(t.tb_frame,t) 434 else: | 405 trace.ignore(ignore) 406 407 sys.argv = arguments 408 sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path 409 410 filename = sys.argv[0] 411 filedata = open(filename, 'r').read() 412 filecode = compile(filedata, filename, 'exec') --- 15 unchanged lines hidden (view full) --- 428 except: 429 traceback.print_exc() 430 print("Uncaught exception. Entering post mortem debugging") 431 t = sys.exc_info()[2] 432 while t.tb_next is not None: 433 t = t.tb_next 434 pdb.interaction(t.tb_frame,t) 435 else: |
435 exec filecode in scope | 436 exec(filecode, scope) |
436 437 # once the script is done 438 if options.interactive: 439 interact(scope) 440 441if __name__ == '__main__': 442 from pprint import pprint 443 444 options, arguments = parse_options() 445 446 print('opts:') 447 pprint(options, indent=4) 448 print() 449 450 print('args:') 451 pprint(arguments, indent=4) | 437 438 # once the script is done 439 if options.interactive: 440 interact(scope) 441 442if __name__ == '__main__': 443 from pprint import pprint 444 445 options, arguments = parse_options() 446 447 print('opts:') 448 pprint(options, indent=4) 449 print() 450 451 print('args:') 452 pprint(arguments, indent=4) |