changeset 05ffa2c3c800 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=05ffa2c3c800
description:
        Errors: Print a URL with a hash of the format string to find more 
information about an error.

diffstat:

7 files changed, 47 insertions(+), 21 deletions(-)
configs/common/Simulation.py |   20 ++++++++++----------
configs/example/fs.py        |    4 ++--
configs/example/se.py        |    2 +-
src/base/misc.cc             |   14 ++++++++++++++
src/python/m5/SimObject.py   |    4 ++--
src/python/m5/__init__.py    |   20 ++++++++++++++++----
src/python/m5/params.py      |    4 ++--

diffs (231 lines):

diff -r 2831ae658bfc -r 05ffa2c3c800 configs/common/Simulation.py
--- a/configs/common/Simulation.py      Fri Jan 30 19:08:13 2009 -0500
+++ b/configs/common/Simulation.py      Fri Jan 30 20:04:15 2009 -0500
@@ -78,10 +78,10 @@
         cptdir = getcwd()
 
     if options.fast_forward and options.checkpoint_restore != None:
-        m5.panic("Error: Can't specify both --fast-forward and 
--checkpoint-restore")
+        m5.fatal("Error: Can't specify both --fast-forward and 
--checkpoint-restore")
 
     if options.standard_switch and not options.caches:
-        m5.panic("Error: Must specify --caches when using --standard-switch")
+        m5.fatal("Error: Must specify --caches when using --standard-switch")
 
     np = options.num_cpus
     max_checkpoints = options.max_checkpoints
@@ -129,7 +129,7 @@
             # Fast forward to a simpoint (warning: time consuming)
             elif options.simpoint:
                 if testsys.cpu[i].workload[0].simpoint == 0:
-                    m5.panic('simpoint not found')
+                    m5.fatal('simpoint not found')
                 testsys.cpu[i].max_insts_any_thread = \
                     testsys.cpu[i].workload[0].simpoint
             # No distance specified, just switch
@@ -163,7 +163,7 @@
         if options.simpoint:
             for i in xrange(np):
                 if testsys.cpu[i].workload[0].simpoint == 0:
-                    m5.panic('no simpoint for testsys.cpu[%d].workload[0]' % i)
+                    m5.fatal('no simpoint for testsys.cpu[%d].workload[0]', i)
                 checkpoint_inst = int(testsys.cpu[i].workload[0].simpoint) + 
offset
                 testsys.cpu[i].max_insts_any_thread = checkpoint_inst
                 # used for output below
@@ -183,13 +183,13 @@
         import re
 
         if not isdir(cptdir):
-            m5.panic("checkpoint dir %s does not exist!" % cptdir)
+            m5.fatal("checkpoint dir %s does not exist!", cptdir)
 
         if options.at_instruction:
             checkpoint_dir = joinpath(cptdir, "cpt.%s.%s" % \
                     (options.bench, options.checkpoint_restore))
             if not exists(checkpoint_dir):
-                m5.panic("Unable to find checkpoint directory %s" % \
+                m5.fatal("Unable to find checkpoint directory %s",
                          checkpoint_dir)
 
             print "Restoring checkpoint ..."
@@ -198,7 +198,7 @@
         elif options.simpoint:
             # assume workload 0 has the simpoint
             if testsys.cpu[0].workload[0].simpoint == 0:
-                m5.panic('Unable to find simpoint')
+                m5.fatal('Unable to find simpoint')
 
             options.checkpoint_restore += \
                 int(testsys.cpu[0].workload[0].simpoint)
@@ -206,8 +206,8 @@
             checkpoint_dir = joinpath(cptdir, "cpt.%s.%d" % \
                     (options.bench, options.checkpoint_restore))
             if not exists(checkpoint_dir):
-                m5.panic("Unable to find checkpoint directory %s.%s" % \
-                        (options.bench, options.checkpoint_restore))
+                m5.fatal("Unable to find checkpoint directory %s.%s",
+                        options.bench, options.checkpoint_restore)
 
             print "Restoring checkpoint ..."
             m5.restoreCheckpoint(root,checkpoint_dir)
@@ -226,7 +226,7 @@
             cpt_num = options.checkpoint_restore
 
             if cpt_num > len(cpts):
-                m5.panic('Checkpoint %d not found' % cpt_num)
+                m5.fatal('Checkpoint %d not found', cpt_num)
 
             ## Adjust max tick based on our starting tick
             maxtick = maxtick - int(cpts[cpt_num - 1])
diff -r 2831ae658bfc -r 05ffa2c3c800 configs/example/fs.py
--- a/configs/example/fs.py     Fri Jan 30 19:08:13 2009 -0500
+++ b/configs/example/fs.py     Fri Jan 30 20:04:15 2009 -0500
@@ -31,7 +31,7 @@
 import m5
 
 if not m5.build_env['FULL_SYSTEM']:
-    m5.panic("This script requires full-system mode (*_FS).")
+    m5.fatal("This script requires full-system mode (*_FS).")
 
 from m5.objects import *
 m5.AddToPath('../common')
@@ -105,7 +105,7 @@
 elif m5.build_env['TARGET_ISA'] == "x86":
     test_sys = makeLinuxX86System(test_mem_mode, bm[0])
 else:
-    m5.panic("incapable of building non-alpha or non-sparc full system!")
+    m5.fatal("incapable of building non-alpha or non-sparc full system!")
 
 if options.kernel is not None:
     test_sys.kernel = binary(options.kernel)
diff -r 2831ae658bfc -r 05ffa2c3c800 configs/example/se.py
--- a/configs/example/se.py     Fri Jan 30 19:08:13 2009 -0500
+++ b/configs/example/se.py     Fri Jan 30 20:04:15 2009 -0500
@@ -33,7 +33,7 @@
 import m5
 
 if m5.build_env['FULL_SYSTEM']:
-    m5.panic("This script requires syscall emulation mode (*_SE).")
+    m5.fatal("This script requires syscall emulation mode (*_SE).")
 
 from m5.objects import *
 import os, optparse, sys
diff -r 2831ae658bfc -r 05ffa2c3c800 src/base/misc.cc
--- a/src/base/misc.cc  Fri Jan 30 19:08:13 2009 -0500
+++ b/src/base/misc.cc  Fri Jan 30 20:04:15 2009 -0500
@@ -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 @@
       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 @@
       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 @@
         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 -r 2831ae658bfc -r 05ffa2c3c800 src/python/m5/SimObject.py
--- a/src/python/m5/SimObject.py        Fri Jan 30 19:08:13 2009 -0500
+++ b/src/python/m5/SimObject.py        Fri Jan 30 20:04:15 2009 -0500
@@ -748,8 +748,8 @@
         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 -r 2831ae658bfc -r 05ffa2c3c800 src/python/m5/__init__.py
--- a/src/python/m5/__init__.py Fri Jan 30 19:08:13 2009 -0500
+++ b/src/python/m5/__init__.py Fri Jan 30 20:04:15 2009 -0500
@@ -37,18 +37,30 @@
 
 # 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 -r 2831ae658bfc -r 05ffa2c3c800 src/python/m5/params.py
--- a/src/python/m5/params.py   Fri Jan 30 19:08:13 2009 -0500
+++ b/src/python/m5/params.py   Fri Jan 30 20:04:15 2009 -0500
@@ -327,8 +327,8 @@
         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
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to