Errors: Print a URL with a hash of the format string to find more information about an error.

This commit is contained in:
Ali Saidi
2009-01-30 20:04:15 -05:00
parent 35a85a4e86
commit f4291aac25
7 changed files with 47 additions and 21 deletions

View File

@@ -748,8 +748,8 @@ class SimObject(object):
for param in param_names:
value = self._values.get(param)
if value is None:
m5.fatal("%s.%s without default or user set value" \
% (self.path(), param))
m5.fatal("%s.%s without default or user set value",
self.path(), param)
value = value.getValue()
if isinstance(self._params[param], VectorParamDesc):

View File

@@ -37,18 +37,30 @@ MaxTick = 2**63 - 1
# define this here so we can use it right away if necessary
def errorURL(prefix, s):
try:
import zlib
hashstr = "%x" % zlib.crc32(s)
except:
hashstr = "UnableToHash"
return "For more information see: http://www.m5sim.org/%s/%s" % \
(prefix, hashstr)
# 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
def panic(fmt, *args):
print >>sys.stderr, 'panic:', fmt % args
print >>sys.stderr, errorURL('panic',fmt)
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
def fatal(fmt, *args):
print >>sys.stderr, 'fatal:', fmt % args
print >>sys.stderr, errorURL('fatal',fmt)
sys.exit(1)
# force scalars to one-element lists for uniformity

View File

@@ -327,8 +327,8 @@ class CheckedIntType(MetaParamValue):
if not (hasattr(cls, 'min') and hasattr(cls, 'max')):
if not (hasattr(cls, 'size') and hasattr(cls, 'unsigned')):
panic("CheckedInt subclass %s must define either\n" \
" 'min' and 'max' or 'size' and 'unsigned'\n" \
% name);
" 'min' and 'max' or 'size' and 'unsigned'\n",
name);
if cls.unsigned:
cls.min = 0
cls.max = 2 ** cls.size - 1