main.py (3887:4a565b35bdee) main.py (4042:dbd98b2264ed)
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
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
33try:
34 import info
35except ImportError:
36 info = None
37
38__all__ = [ 'options', 'arguments', 'main' ]
39
40usage="%prog [m5 options] script.py [script options]"
41version="%prog 2.0"
42brief_copyright='''
43Copyright (c) 2001-2006
44The Regents of The University of Michigan
45All Rights Reserved

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

139 help="Cycle to create a breakpoint")
140
141# Tracing options
142set_group("Trace Options")
143add_option("--trace-flags", metavar="FLAG[,FLAG]", action='append', split=',',
144 help="Sets the flags for tracing")
145add_option("--trace-start", metavar="TIME", default='0s',
146 help="Start tracing at TIME (must have units)")
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)")
147add_option("--trace-cycle", metavar="CYCLE", default='0',
148 help="Start tracing at CYCLE")
149add_option("--trace-file", metavar="FILE", default="cout",
150 help="Sets the output file for tracing [Default: %default]")
151add_option("--trace-circlebuf", metavar="SIZE", type="int", default=0,
152 help="If SIZE is non-zero, turn on the circular buffer with SIZE lines")
153add_option("--no-trace-circlebuf", action="store_const", const=0,
154 dest='trace_circlebuf', help=optparse.SUPPRESS_HELP)
155bool_option("trace-dumponexit", default=False,
156 help="Dump trace buffer on exit")

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

206
207 del opts.quiet
208
209 options.update(opts)
210 arguments.extend(args)
211 return opts,args
212
213def main():
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
214 import internal
215
216 parse_args()
217
218 done = False
219 if options.copyright:
220 done = True
221 print info.LICENSE

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

273
274 # set stats options
275 objects.Statistics.text_file = options.stats_file
276
277 # set debugging options
278 for when in options.debug_break:
279 internal.debug.schedBreakCycle(int(when))
280
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
281 # set tracing options
282 objects.Trace.flags = options.trace_flags
283 objects.Trace.start = options.trace_start
284 objects.Trace.cycle = options.trace_cycle
285 objects.Trace.file = options.trace_file
286 objects.Trace.bufsize = options.trace_circlebuf
287 objects.Trace.dump_on_exit = options.trace_dumponexit
288 objects.Trace.ignore = options.trace_ignore
276 for flag in options.trace_flags:
277 internal.trace.setFlag(flag)
289
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
290 # set execution trace options
291 objects.ExecutionTrace.speculative = options.speculative
292 objects.ExecutionTrace.print_cycle = options.print_cycle
293 objects.ExecutionTrace.pc_symbol = options.print_symbol
294 objects.ExecutionTrace.print_opclass = options.print_opclass
295 objects.ExecutionTrace.print_thread = options.print_thread
296 objects.ExecutionTrace.print_effaddr = options.print_effaddr
297 objects.ExecutionTrace.print_data = options.print_data

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

304 sys.argv = arguments
305 sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path
306
307 scope = { '__file__' : sys.argv[0],
308 '__name__' : '__m5_main__' }
309
310 # we want readline if we're doing anything interactive
311 if options.interactive or options.pdb:
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:
312 exec("import readline", scope)
319 exec "import readline" in scope
313
314 # if pdb was requested, execfile the thing under pdb, otherwise,
315 # just do the execfile normally
316 if options.pdb:
317 from pdb import Pdb
318 debugger = Pdb()
319 debugger.run('execfile("%s")' % sys.argv[0], scope)
320 else:

--- 18 unchanged lines hidden ---
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 ---