Merge zizzer:/bk/multiarch
[gem5.git] / base / trace.hh
index 1aadb36cf98bad7f753811f1493854c682532541..5e14f1bfff7ce354217f1d741a4e164d12cc48d3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001-2004 The Regents of The University of Michigan
+ * Copyright (c) 2001-2005 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef __TRACE_HH__
-#define __TRACE_HH__
+#ifndef __BASE_TRACE_HH__
+#define __BASE_TRACE_HH__
 
 #include <vector>
 
 #include "base/cprintf.hh"
 #include "base/match.hh"
 #include "sim/host.hh"
-#include "sim/universe.hh"
+#include "sim/root.hh"
 
 #ifndef TRACING_ON
 #ifndef NDEBUG
@@ -157,8 +157,16 @@ namespace Trace {
     extern const std::string DefaultName;
 };
 
-inline const std::string &name() { return Trace::DefaultName; }
+// This silly little class allows us to wrap a string in a functor
+// object so that we can give a name() that DPRINTF will like
+struct StringWrap
+{
+    std::string str;
+    StringWrap(const std::string &s) : str(s) {}
+    const std::string &operator()() const { return str; }
+};
 
+inline const std::string &name() { return Trace::DefaultName; }
 std::ostream &DebugOut();
 
 //
@@ -195,7 +203,7 @@ do { \
 #define DPRINTFR(x, args...) \
 do { \
     if (Trace::IsOn(Trace::x)) \
-        __dprintf((Tick)-1, string(), args, cp::ArgListNull()); \
+        __dprintf((Tick)-1, std::string(), args, cp::ArgListNull());   \
 } while (0)
 
 #define DPRINTFN(args...) \
@@ -220,4 +228,4 @@ do { \
 
 #endif // TRACING_ON
 
-#endif // __TRACE_HH__
+#endif // __BASE_TRACE_HH__