From eddac53ff60c579eff28134bde84783fe36d6214 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Fri, 15 Apr 2011 10:44:32 -0700 Subject: trace: reimplement the DTRACE function so it doesn't use a vector At the same time, rename the trace flags to debug flags since they have broader usage than simply tracing. This means that --trace-flags is now --debug-flags and --trace-help is now --debug-help --- src/base/trace.hh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/base/trace.hh') diff --git a/src/base/trace.hh b/src/base/trace.hh index a03a34018..dbeffdc8b 100644 --- a/src/base/trace.hh +++ b/src/base/trace.hh @@ -33,23 +33,22 @@ #define __BASE_TRACE_HH__ #include -#include #include "base/cprintf.hh" +#include "base/debug.hh" #include "base/match.hh" -#include "base/traceflags.hh" #include "base/types.hh" #include "sim/core.hh" namespace Trace { +using Debug::SimpleFlag; +using Debug::CompoundFlag; + std::ostream &output(); void setOutput(const std::string &filename); extern bool enabled; -typedef std::vector FlagVec; -extern FlagVec flags; -inline bool IsOn(int t) { return flags[t]; } bool changeFlag(const char *str, bool value); void dumpStatus(); @@ -85,25 +84,28 @@ inline const std::string &name() { return Trace::DefaultName; } #if TRACING_ON -#define DTRACE(x) (Trace::IsOn(Trace::x) && Trace::enabled) +#define DTRACE(x) ((Debug::x) && Trace::enabled) #define DDUMP(x, data, count) do { \ + using namespace Debug; \ if (DTRACE(x)) \ Trace::dump(curTick(), name(), data, count); \ } while (0) #define DPRINTF(x, ...) do { \ + using namespace Debug; \ if (DTRACE(x)) \ Trace::dprintf(curTick(), name(), __VA_ARGS__); \ } while (0) -#define DPRINTFS(x,s, ...) do { \ +#define DPRINTFS(x, s, ...) do { \ + using namespace Debug; \ if (DTRACE(x)) \ - Trace::dprintf(curTick(), s->name(), __VA_ARGS__); \ + Trace::dprintf(curTick(), s->name(), __VA_ARGS__); \ } while (0) - #define DPRINTFR(x, ...) do { \ + using namespace Debug; \ if (DTRACE(x)) \ Trace::dprintf((Tick)-1, std::string(), __VA_ARGS__); \ } while (0) -- cgit v1.2.3