/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <iostream>
#include <string>
-#include "host.hh"
-#include "cprintf.hh"
-#include "misc.hh"
-#include "universe.hh"
-#include "trace.hh"
+#include "base/cprintf.hh"
+#include "base/hostinfo.hh"
+#include "base/misc.hh"
+#include "base/output.hh"
+#include "base/trace.hh"
+#include "sim/host.hh"
+#include "sim/root.hh"
using namespace std;
__panic(const string &format, cp::ArgList &args, const char *func,
const char *file, int line)
{
- string fmt = "panic: " + format + " [%s:%s, line %d]\n";
+ string fmt = "panic: " + format;
+ switch (fmt[fmt.size() - 1]) {
+ case '\n':
+ case '\r':
+ break;
+ default:
+ fmt += "\n";
+ }
+
+ fmt += " @ cycle %d\n[%s:%s, line %d]\n";
+
+ args.append(curTick);
args.append(func);
args.append(file);
args.append(line);
delete &args;
-#if TRACING_ON
- // dump trace buffer, if there is one
- Trace::theLog.dump(cerr);
-#endif
-
abort();
}
__fatal(const string &format, cp::ArgList &args, const char *func,
const char *file, int line)
{
- long mem_usage();
+ string fmt = "fatal: " + format;
+
+ switch (fmt[fmt.size() - 1]) {
+ case '\n':
+ case '\r':
+ break;
+ default:
+ fmt += "\n";
+ }
- string fmt = "fatal: " + format + " [%s:%s, line %d]\n"
- "\n%d\nMemory Usage: %ld KBytes\n";
+ fmt += " @ cycle %d\n[%s:%s, line %d]\n";
+ fmt += "Memory Usage: %ld KBytes\n";
+ args.append(curTick);
args.append(func);
args.append(file);
args.append(line);
- args.append(curTick);
- args.append(mem_usage());
+ args.append(memUsage());
args.dump(cerr, fmt);
delete &args;
const char *file, int line)
{
string fmt = "warn: " + format;
+
+ switch (fmt[fmt.size() - 1]) {
+ case '\n':
+ case '\r':
+ break;
+ default:
+ fmt += "\n";
+ }
+
#ifdef VERBOSE_WARN
- fmt += " [%s:%s, line %d]\n";
+ fmt += " @ cycle %d\n[%s:%s, line %d]\n";
+ args.append(curTick);
args.append(func);
args.append(file);
args.append(line);
-#else
- fmt += "\n";
#endif
+
args.dump(cerr, fmt);
+ if (simout.isFile(*outputStream))
+ args.dump(*outputStream, fmt);
delete &args;
}