From: Gabe Black Date: Mon, 25 May 2020 23:24:42 +0000 (-0700) Subject: base,sim: Move DTRACE into base/debug.hh. X-Git-Tag: v20.1.0.0~611 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d64173549b23ecd3fc3c9468f63bf55971d9e769;p=gem5.git base,sim: Move DTRACE into base/debug.hh. All other considerations aside, DTRACE probably fits best in trace.hh where it is now, but unfortunately that creates an awkward dependence between that file and eventq.hh and eventq_impl.hh. DTRACE only depends on flags in the Debug namespace and a universal macro TRACING_ON, so even though it won't be alongside the things it's most logically associated with, it will be alongside all of its dependencies. An alternative would be to re-implement DTRACE in eventq_impl.hh which wouldn't be too big of a problem because it's so simple, but it's cleaner and less error prone to still keep a single definition. Because base/trace.hh includes base/debug.hh, any consumers expecting to find DTRACE in base/trace.hh will still get that definition, even though it's no longer direct. Change-Id: I0dac83295891630686c3a8038eb54138cf40ab44 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29411 Maintainer: Gabe Black Tested-by: kokoro Reviewed-by: Jason Lowe-Power --- diff --git a/src/base/debug.hh b/src/base/debug.hh index 527af6a70..7c9834ce7 100644 --- a/src/base/debug.hh +++ b/src/base/debug.hh @@ -137,4 +137,10 @@ void clearDebugFlag(const char *string); void dumpDebugFlags(); +#if TRACING_ON +# define DTRACE(x) (Debug::x) +#else // !TRACING_ON +# define DTRACE(x) (false) +#endif // TRACING_ON + #endif // __BASE_DEBUG_HH__ diff --git a/src/base/trace.hh b/src/base/trace.hh index c3372e709..c3a499b9d 100644 --- a/src/base/trace.hh +++ b/src/base/trace.hh @@ -168,8 +168,6 @@ class Named #if TRACING_ON -#define DTRACE(x) (Debug::x) - #define DDUMP(x, data, count) do { \ using namespace Debug; \ if (DTRACE(x)) \ @@ -220,7 +218,6 @@ class Named #else // !TRACING_ON -#define DTRACE(x) (false) #define DDUMP(x, data, count) do {} while (0) #define DPRINTF(x, ...) do {} while (0) #define DPRINTFS(x, ...) do {} while (0) diff --git a/src/sim/eventq_impl.hh b/src/sim/eventq_impl.hh index 39bf00b44..0e4f40813 100644 --- a/src/sim/eventq_impl.hh +++ b/src/sim/eventq_impl.hh @@ -31,7 +31,7 @@ #ifndef __SIM_EVENTQ_IMPL_HH__ #define __SIM_EVENTQ_IMPL_HH__ -#include "base/trace.hh" +#include "base/debug.hh" #include "sim/eventq.hh" inline void