If given, a stack trace is printed after every debug message.
This helps to localize where debug messages are being called from,
which is often the critical information needed to debug certain
problems.
Change-Id: I82b8990c0d286393d5bdab05f718be3e89eadc40
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22003
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
DebugFlag('AnnotateQ', "State machine annotation queue debugging")
DebugFlag('AnnotateVerbose', "Dump all state machine annotation details")
DebugFlag('FmtFlag', "Show the --debug-flag that enabled each debug message")
+DebugFlag('FmtStackTrace',
+ "Print a stack trace after every debug message")
DebugFlag('FmtTicksOff', "Don't show tick count on debug messages")
DebugFlag('GDBAcc', "Remote debugger accesses")
DebugFlag('GDBExtra', "Dump extra information on reads and writes")
#include <sstream>
#include <string>
+#include "base/atomicio.hh"
#include "base/debug.hh"
#include "base/logging.hh"
#include "base/output.hh"
#include "base/str.hh"
#include "debug/FmtFlag.hh"
+#include "debug/FmtStackTrace.hh"
#include "debug/FmtTicksOff.hh"
+#include "sim/backtrace.hh"
const std::string &name()
{
stream << message;
stream.flush();
+
+ if (DTRACE(FmtStackTrace)) {
+ print_backtrace();
+ STATIC_ERR("\n");
+ }
}
} // namespace Trace