summaryrefslogtreecommitdiff
path: root/src/base/trace.cc
diff options
context:
space:
mode:
authorCiro Santilli <ciro.santilli@arm.com>2019-10-08 14:31:47 +0100
committerCiro Santilli <ciro.santilli@arm.com>2019-11-26 12:46:59 +0000
commit105b2c8914946867f040caf6a8ff7da3c5d028d7 (patch)
tree63ed34a98e44bfeb7d5a10820f7fc2002a0fdef8 /src/base/trace.cc
parente82a6f32cb3432566bbe9f00bc93e3b14f8db998 (diff)
downloadgem5-105b2c8914946867f040caf6a8ff7da3c5d028d7.tar.xz
base: add the --debug-flag to DPRINTF output with FmtFlag
This makes it easier to determine which messages come from which flags when enabling multiple flags at once. This commit covers the bulk of the debug messages, which use the DPRINTF* family of macros. There however macros that use DTRACE to check for enable, those will be covered in future patches. Change-Id: I6738b18f08ccfd1e11f2874b426c1827b42e82a2 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22004 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/base/trace.cc')
-rw-r--r--src/base/trace.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/base/trace.cc b/src/base/trace.cc
index 06f9eeb21..c7f338bf5 100644
--- a/src/base/trace.cc
+++ b/src/base/trace.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 ARM Limited
+ * Copyright (c) 2014, 2019 ARM Limited
* All rights reserved
*
* Copyright (c) 2001-2006 The Regents of The University of Michigan
@@ -45,6 +45,7 @@
#include "base/logging.hh"
#include "base/output.hh"
#include "base/str.hh"
+#include "debug/FmtFlag.hh"
const std::string &name()
{
@@ -101,8 +102,10 @@ disable()
ObjectMatch ignore;
+
void
-Logger::dump(Tick when, const std::string &name, const void *d, int len)
+Logger::dump(Tick when, const std::string &name,
+ const void *d, int len, const std::string &flag)
{
if (!name.empty() && ignore.match(name))
return;
@@ -133,7 +136,7 @@ Logger::dump(Tick when, const std::string &name, const void *d, int len)
}
ccprintf(line, "\n");
- logMessage(when, name, line.str());
+ logMessage(when, name, flag, line.str());
if (c < 16)
break;
@@ -142,7 +145,7 @@ Logger::dump(Tick when, const std::string &name, const void *d, int len)
void
OstreamLogger::logMessage(Tick when, const std::string &name,
- const std::string &message)
+ const std::string &flag, const std::string &message)
{
if (!name.empty() && ignore.match(name))
return;
@@ -150,6 +153,9 @@ OstreamLogger::logMessage(Tick when, const std::string &name,
if (when != MaxTick)
ccprintf(stream, "%7d: ", when);
+ if (DTRACE(FmtFlag) && !flag.empty())
+ stream << flag << ": ";
+
if (!name.empty())
stream << name << ": ";