python: add fatal() function to the m5 package and use it
authorNathan Binkert <nate@binkert.org>
Mon, 19 Jan 2009 22:43:09 +0000 (14:43 -0800)
committerNathan Binkert <nate@binkert.org>
Mon, 19 Jan 2009 22:43:09 +0000 (14:43 -0800)
src/python/m5/__init__.py
src/python/m5/main.py

index 3a6d39499bae3eef7325ef25b01343a1515766f1..97b22ef2a1f3269d7c8e9eb566ddd02e95e26859 100644 (file)
@@ -36,10 +36,21 @@ import smartdict
 MaxTick = 2**63 - 1
 
 # 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):
     print >>sys.stderr, 'panic:', string
     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
 def makeList(objOrList):
     if isinstance(objOrList, list):
index 19ceaf10da32f66fcb9f1ade500c3c8ee432c58d..38adac6324868e90213a68f4ba09cabe94212c57 100644 (file)
@@ -147,7 +147,7 @@ def main():
         if defines.TRACING_ON:
             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
     # default options