diff options
author | Ali Saidi <saidi@eecs.umich.edu> | 2009-01-30 20:04:15 -0500 |
---|---|---|
committer | Ali Saidi <saidi@eecs.umich.edu> | 2009-01-30 20:04:15 -0500 |
commit | f4291aac256622546a5a51dce109599007f5b3cb (patch) | |
tree | b40cdfa74233584291953ec236ff20aaf159a1fb /src | |
parent | 35a85a4e86143c5bf23d5b74c14856792a0a624c (diff) | |
download | gem5-f4291aac256622546a5a51dce109599007f5b3cb.tar.xz |
Errors: Print a URL with a hash of the format string to find more information about an error.
Diffstat (limited to 'src')
-rw-r--r-- | src/base/misc.cc | 14 | ||||
-rw-r--r-- | src/python/m5/SimObject.py | 4 | ||||
-rw-r--r-- | src/python/m5/__init__.py | 20 | ||||
-rw-r--r-- | src/python/m5/params.py | 4 |
4 files changed, 34 insertions, 8 deletions
diff --git a/src/base/misc.cc b/src/base/misc.cc index b0c769ac6..035282baf 100644 --- a/src/base/misc.cc +++ b/src/base/misc.cc @@ -31,6 +31,7 @@ #include <cstdlib> #include <iostream> #include <string> +#include <zlib.h> #include "base/cprintf.hh" #include "base/hostinfo.hh" @@ -68,15 +69,20 @@ __exit_message(const char *prefix, int code, default: format += "\n"; } + + uint32_t crc = crc32(0, (const Bytef*)fmt, strlen(fmt)); format += " @ cycle %d\n[%s:%s, line %d]\n"; format += "Memory Usage: %ld KBytes\n"; + format += "For more information see: http://www.m5sim.org/%s/%x\n"; args.push_back(curTick); args.push_back(func); args.push_back(file); args.push_back(line); args.push_back(memUsage()); + args.push_back(prefix); + args.push_back(crc); ccprintf(cerr, format.c_str(), args); @@ -103,6 +109,8 @@ __base_message(std::ostream &stream, const char *prefix, bool verbose, default: format += "\n"; } + + uint32_t crc = crc32(0, (const Bytef*)fmt, strlen(fmt)); if (verbose) { format += " @ cycle %d\n[%s:%s, line %d]\n"; @@ -112,5 +120,11 @@ __base_message(std::ostream &stream, const char *prefix, bool verbose, args.push_back(line); } + if (strcmp(prefix, "warn") == 0) { + format += "For more information see: http://www.m5sim.org/%s/%x\n"; + args.push_back(prefix); + args.push_back(crc); + } + ccprintf(stream, format.c_str(), args); } diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py index 2b5dd1bc2..1db9c7495 100644 --- a/src/python/m5/SimObject.py +++ b/src/python/m5/SimObject.py @@ -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): diff --git a/src/python/m5/__init__.py b/src/python/m5/__init__.py index 97b22ef2a..733258acf 100644 --- a/src/python/m5/__init__.py +++ b/src/python/m5/__init__.py @@ -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 diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 081bd342e..18eeac0d1 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -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 |