summaryrefslogtreecommitdiff
path: root/src/base/trace.cc
diff options
context:
space:
mode:
authorCiro Santilli <ciro.santilli@arm.com>2019-10-14 11:42:54 +0100
committerCiro Santilli <ciro.santilli@arm.com>2019-12-03 11:19:33 +0000
commitaa72c284e23566495e4dac4d2d85325751fb1bb8 (patch)
treef19d7b66014e34850f39e11ad55ed3f09398c654 /src/base/trace.cc
parent7e4967995e4bbcfac877852437c4ab6bf6d70e47 (diff)
downloadgem5-aa72c284e23566495e4dac4d2d85325751fb1bb8.tar.xz
base: add the FmtStackTrace debug option
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>
Diffstat (limited to 'src/base/trace.cc')
-rw-r--r--src/base/trace.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/base/trace.cc b/src/base/trace.cc
index 6b18787c2..70d81a1ea 100644
--- a/src/base/trace.cc
+++ b/src/base/trace.cc
@@ -41,12 +41,15 @@
#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()
{
@@ -162,6 +165,11 @@ OstreamLogger::logMessage(Tick when, const std::string &name,
stream << message;
stream.flush();
+
+ if (DTRACE(FmtStackTrace)) {
+ print_backtrace();
+ STATIC_ERR("\n");
+ }
}
} // namespace Trace