main.py (5528:10a17e8a6d35) main.py (5586:d27058799d3a)
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
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
37import defines
38from options import OptionParser
37from options import OptionParser
39import traceflags
40
41__all__ = [ 'options', 'arguments', 'main' ]
42
43def print_list(items, indent=4):
44 line = ' ' * indent
45 for i,item in enumerate(items):
46 if len(line) + len(item) > 76:
47 print line

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

127 help="Ignore EXPR sim objects")
128
129# Help options
130set_group("Help Options")
131add_option("--list-sim-objects", action='store_true', default=False,
132 help="List all built-in SimObjects, their parameters and default values")
133
134def main():
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():
135 import defines
136 import event
137 import info
138 import internal
139
140 # load the options.py config file to allow people to set their own
141 # default options
142 options_file = config.get('options.py')
143 if options_file:

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

171
172 if options.redirect_stderr:
173 redir_fd = os.open(stderr_file, os. O_WRONLY | os.O_CREAT | os.O_TRUNC)
174 os.dup2(redir_fd, sys.stderr.fileno())
175
176 done = False
177
178 if options.build_info:
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
179 done = True
180 print 'Build information:'
181 print
182 print 'compiled %s' % internal.core.cvar.compileDate;
183 print "revision %s" % internal.core.cvar.hgRev
184 print "commit date %s" % internal.core.cvar.hgDate
185 print 'build options:'
186 keys = defines.m5_build_env.keys()

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

212 if options.release_notes:
213 done = True
214 print 'Release Notes:'
215 print
216 print info.RELEASE_NOTES
217 print
218
219 if options.trace_help:
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
220 done = True
221 print "Base Flags:"
222 print_list(traceflags.baseFlags, indent=4)
223 print
224 print "Compound Flags:"
225 for flag in traceflags.compoundFlags:
226 if flag == 'All':
227 continue

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

292 # set stats options
293 internal.stats.initText(options.stats_file)
294
295 # set debugging options
296 internal.debug.setRemoteGDBPort(options.remote_gdb_port)
297 for when in options.debug_break:
298 internal.debug.schedBreakCycle(int(when))
299
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
300 on_flags = []
301 off_flags = []
302 for flag in options.trace_flags:
303 off = False
304 if flag.startswith('-'):
305 flag = flag[1:]
306 off = True
307 if flag not in traceflags.allFlags:
308 print >>sys.stderr, "invalid trace flag '%s'" % flag
309 sys.exit(1)
301 if options.trace_flags:
302 import traceflags
310
303
311 if off:
312 off_flags.append(flag)
313 else:
314 on_flags.append(flag)
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)
315
314
316 for flag in on_flags:
317 internal.trace.set(flag)
315 if off:
316 off_flags.append(flag)
317 else:
318 on_flags.append(flag)
318
319
319 for flag in off_flags:
320 internal.trace.clear(flag)
320 for flag in on_flags:
321 internal.trace.set(flag)
321
322
323 for flag in off_flags:
324 internal.trace.clear(flag)
325
322 if options.trace_start:
323 def enable_trace():
324 internal.trace.cvar.enabled = True
325 event.create(enable_trace, int(options.trace_start))
326 else:
327 internal.trace.cvar.enabled = True
328
329 internal.trace.output(options.trace_file)

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

353 # once the script is done
354 if options.interactive:
355 interact = code.InteractiveConsole(scope)
356 interact.interact("M5 Interactive Console")
357
358if __name__ == '__main__':
359 from pprint import pprint
360
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
361 parse_args()
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)
362
371
372 arguments = options.parse_args()
373
363 print 'opts:'
364 pprint(options, indent=4)
365 print
366
367 print 'args:'
368 pprint(arguments, indent=4)
374 print 'opts:'
375 pprint(options, indent=4)
376 print
377
378 print 'args:'
379 pprint(arguments, indent=4)