changeset 1fb28f526602 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=1fb28f526602
description:
        python: add fatal() function to the m5 package and use it

diffstat:

2 files changed, 12 insertions(+), 1 deletion(-)
src/python/m5/__init__.py |   11 +++++++++++
src/python/m5/main.py     |    2 +-

diffs (37 lines):

diff -r e0850da03cd4 -r 1fb28f526602 src/python/m5/__init__.py
--- a/src/python/m5/__init__.py Mon Jan 19 09:59:15 2009 -0800
+++ b/src/python/m5/__init__.py Mon Jan 19 14:43:09 2009 -0800
@@ -36,10 +36,21 @@
 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):
diff -r e0850da03cd4 -r 1fb28f526602 src/python/m5/main.py
--- a/src/python/m5/main.py     Mon Jan 19 09:59:15 2009 -0800
+++ b/src/python/m5/main.py     Mon Jan 19 14:43:09 2009 -0800
@@ -147,7 +147,7 @@
         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
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to