main.py (5773:7434b2271b0c) main.py (5799:0af61da2b66a)
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

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

133set_group("Help Options")
134add_option("--list-sim-objects", action='store_true', default=False,
135 help="List all built-in SimObjects, their parameters and default values")
136
137def main():
138 import event
139 import info
140 import internal
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

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

133set_group("Help Options")
134add_option("--list-sim-objects", action='store_true', default=False,
135 help="List all built-in SimObjects, their parameters and default values")
136
137def main():
138 import event
139 import info
140 import internal
141 import trace
141
142
143 def check_tracing():
144 if defines.TRACING_ON:
145 return
146
147 panic("Tracing is not enabled. Compile with TRACING_ON")
148
142 # load the options.py config file to allow people to set their own
143 # default options
144 options_file = config.get('options.py')
145 if options_file:
146 scope = { 'options' : options }
147 execfile(options_file, scope)
148
149 arguments = options.parse_args()

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

216 if options.release_notes:
217 done = True
218 print 'Release Notes:'
219 print
220 print info.RELEASE_NOTES
221 print
222
223 if options.trace_help:
149 # load the options.py config file to allow people to set their own
150 # default options
151 options_file = config.get('options.py')
152 if options_file:
153 scope = { 'options' : options }
154 execfile(options_file, scope)
155
156 arguments = options.parse_args()

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

223 if options.release_notes:
224 done = True
225 print 'Release Notes:'
226 print
227 print info.RELEASE_NOTES
228 print
229
230 if options.trace_help:
224 import traceflags
225
226 done = True
231 done = True
227 print "Base Flags:"
228 traceflags.baseFlags.sort()
229 print_list(traceflags.baseFlags, indent=4)
230 print
231 print "Compound Flags:"
232 traceflags.compoundFlags.sort()
233 for flag in traceflags.compoundFlags:
234 if flag == 'All':
235 continue
236 print " %s:" % flag
237 print_list(traceflags.compoundFlagMap[flag], indent=8)
238 print
232 check_tracing()
233 trace.help()
239
240 if options.list_sim_objects:
241 import SimObject
242 done = True
243 print "SimObjects:"
244 objects = SimObject.allClasses.keys()
245 objects.sort()
246 for name in objects:

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

301 internal.stats.initText(options.stats_file)
302
303 # set debugging options
304 internal.debug.setRemoteGDBPort(options.remote_gdb_port)
305 for when in options.debug_break:
306 internal.debug.schedBreakCycle(int(when))
307
308 if options.trace_flags:
234
235 if options.list_sim_objects:
236 import SimObject
237 done = True
238 print "SimObjects:"
239 objects = SimObject.allClasses.keys()
240 objects.sort()
241 for name in objects:

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

296 internal.stats.initText(options.stats_file)
297
298 # set debugging options
299 internal.debug.setRemoteGDBPort(options.remote_gdb_port)
300 for when in options.debug_break:
301 internal.debug.schedBreakCycle(int(when))
302
303 if options.trace_flags:
309 import traceflags
304 check_tracing()
310
311 on_flags = []
312 off_flags = []
313 for flag in options.trace_flags:
314 off = False
315 if flag.startswith('-'):
316 flag = flag[1:]
317 off = True
305
306 on_flags = []
307 off_flags = []
308 for flag in options.trace_flags:
309 off = False
310 if flag.startswith('-'):
311 flag = flag[1:]
312 off = True
318 if flag not in traceflags.allFlags and flag != "All":
313 if flag not in trace.flags.all and flag != "All":
319 print >>sys.stderr, "invalid trace flag '%s'" % flag
320 sys.exit(1)
321
322 if off:
323 off_flags.append(flag)
324 else:
325 on_flags.append(flag)
326
327 for flag in on_flags:
314 print >>sys.stderr, "invalid trace flag '%s'" % flag
315 sys.exit(1)
316
317 if off:
318 off_flags.append(flag)
319 else:
320 on_flags.append(flag)
321
322 for flag in on_flags:
328 internal.trace.set(flag)
323 trace.set(flag)
329
330 for flag in off_flags:
324
325 for flag in off_flags:
331 internal.trace.clear(flag)
326 trace.clear(flag)
332
333 if options.trace_start:
327
328 if options.trace_start:
334 def enable_trace():
335 internal.trace.cvar.enabled = True
336
337 e = event.create(enable_trace)
329 check_tracing()
330 e = event.create(trace.enable)
338 event.mainq.schedule(e, options.trace_start)
339 else:
331 event.mainq.schedule(e, options.trace_start)
332 else:
340 internal.trace.cvar.enabled = True
333 trace.enable()
341
334
342 internal.trace.output(options.trace_file)
335 trace.output(options.trace_file)
343
344 for ignore in options.trace_ignore:
336
337 for ignore in options.trace_ignore:
345 internal.trace.ignore(ignore)
338 check_tracing()
339 trace.ignore(ignore)
346
347 sys.argv = arguments
348 sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path
349
350 filename = sys.argv[0]
351 filedata = file(filename, 'r').read()
352 filecode = compile(filedata, filename, 'exec')
353 scope = { '__file__' : filename,

--- 51 unchanged lines hidden ---
340
341 sys.argv = arguments
342 sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path
343
344 filename = sys.argv[0]
345 filedata = file(filename, 'r').read()
346 filecode = compile(filedata, filename, 'exec')
347 scope = { '__file__' : filename,

--- 51 unchanged lines hidden ---