python: add fatal() function to the m5 package and use it

This commit is contained in:
Nathan Binkert 2009-01-19 14:43:09 -08:00
parent da14789c32
commit 81b8c0c79a
2 changed files with 12 additions and 1 deletions

View file

@ -36,10 +36,21 @@ import smartdict
MaxTick = 2**63 - 1 MaxTick = 2**63 - 1
# define this here so we can use it right away if necessary # define this here so we can use it right away if necessary
# panic() should be called when something happens that should never
# ever happen regardless of what the user does (i.e., an acutal m5
# bug).
def panic(string): def panic(string):
print >>sys.stderr, 'panic:', string print >>sys.stderr, 'panic:', string
sys.exit(1) sys.exit(1)
# fatal() should be called when the simulation cannot continue due to
# some condition that is the user's fault (bad configuration, invalid
# arguments, etc.) and not a simulator bug.
def fatal(string):
print >>sys.stderr, 'fatal:', string
sys.exit(1)
# force scalars to one-element lists for uniformity # force scalars to one-element lists for uniformity
def makeList(objOrList): def makeList(objOrList):
if isinstance(objOrList, list): if isinstance(objOrList, list):

View file

@ -147,7 +147,7 @@ def main():
if defines.TRACING_ON: if defines.TRACING_ON:
return return
panic("Tracing is not enabled. Compile with TRACING_ON") fatal("Tracing is not enabled. Compile with TRACING_ON")
# load the options.py config file to allow people to set their own # load the options.py config file to allow people to set their own
# default options # default options