49 #include "debug/FmtFlag.hh" 50 #include "debug/FmtStackTrace.hh" 51 #include "debug/FmtTicksOff.hh" 56 static const std::string default_name(
"global");
90 warn(
"Trying to set debug logger to NULL\n");
92 debug_logger = logger;
112 const void *
d,
int len,
const std::string &flag)
114 if (!name.empty() && ignore.
match(name))
117 const char *
data =
static_cast<const char *
>(
d);
120 for (i = 0; i <
len; i += 16) {
121 std::ostringstream line;
127 for (j = 0; j <
c; j++) {
128 ccprintf(line,
"%02x ", data[i + j] & 0xff);
129 if ((j & 0xf) == 7 && j > 0)
137 for (j = 0; j <
c; j++) {
138 int ch = data[i +
j] & 0x7f;
139 ccprintf(line,
"%c", (
char)(isprint(ch) ? ch :
' '));
152 const std::string &flag,
const std::string &message)
154 if (!name.empty() && ignore.
match(name))
160 if (
DTRACE(FmtFlag) && !flag.empty())
161 stream << flag <<
": ";
164 stream << name <<
": ";
169 if (
DTRACE(FmtStackTrace)) {
void ccprintf(cp::Print &print)
const std::string & name()
void print_backtrace()
Print a gem5 post-mortem report.
bool match(const std::string &name) const
virtual std::ostream & getOstream()=0
Return an ostream that can be used to send messages to the 'same place' as formatted logMessage messa...
uint64_t Tick
Tick count type.
Debug logging base class.
std::ostream & output()
Get the ostream from the current global logger.
Logging wrapper for ostreams with the format: <when>: <name>: <message-body>
virtual void logMessage(Tick when, const std::string &name, const std::string &flag, const std::string &message)=0
Log formatted message.
Logger * getDebugLogger()
Get the current global debug logger.
#define STATIC_ERR(m)
Statically allocate a string and write it to STDERR.
void enable()
Enable/disable debug logging.
void setDebugLogger(Logger *logger)
Delete the current global logger and assign a new one.
ObjectMatch contains a vector of expressions.
void dump(Tick when, const std::string &name, const void *d, int len, const std::string &flag)
Dump a block of data of length len.
void logMessage(Tick when, const std::string &name, const std::string &flag, const std::string &message) override
Log formatted message.