summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2009-01-19 14:43:09 -0800
committerNathan Binkert <nate@binkert.org>2009-01-19 14:43:09 -0800
commit81b8c0c79a0ed55f2d81fc66bf7e4667f708c1de (patch)
tree4a8cbc7119377f5f17381f21b00a5cabc2a4c3de /src
parentda14789c32e14c62cdb0e11957607955e2a19c8a (diff)
downloadgem5-81b8c0c79a0ed55f2d81fc66bf7e4667f708c1de.tar.xz
python: add fatal() function to the m5 package and use it
Diffstat (limited to 'src')
-rw-r--r--src/python/m5/__init__.py11
-rw-r--r--src/python/m5/main.py2
2 files changed, 12 insertions, 1 deletions
diff --git a/src/python/m5/__init__.py b/src/python/m5/__init__.py
index 3a6d39499..97b22ef2a 100644
--- a/src/python/m5/__init__.py
+++ b/src/python/m5/__init__.py
@@ -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):
diff --git a/src/python/m5/main.py b/src/python/m5/main.py
index 19ceaf10d..38adac632 100644
--- a/src/python/m5/main.py
+++ b/src/python/m5/main.py
@@ -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