File tree 3 files changed +27
-0
lines changed
3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,13 @@ using namespace icinga;
14
14
15
15
std::ostream &icinga::operator <<(std::ostream &os, const StackTraceFormatter &f)
16
16
{
17
+ /* In most cases, this operator<< just relies on the operator<< for the `boost::stacktrace::stacktrace` wrapped in
18
+ * the `StackTraceFormatter`. But as this operator turned out to not work properly on some platforms, there is a
19
+ * fallback implementation that can be enabled using the `-DICINGA2_STACKTRACE_USE_BACKTRACE_SYMBOLS` flag at
20
+ * compile time. This will then switch to `backtrace_symbols()` from `<execinfo.h>` instead of the implementation
21
+ * provided by Boost.
22
+ */
23
+
17
24
const boost::stacktrace::stacktrace &stack = f.m_Stack ;
18
25
19
26
#ifdef ICINGA2_STACKTRACE_USE_BACKTRACE_SYMBOLS
Original file line number Diff line number Diff line change 8
8
namespace icinga
9
9
{
10
10
11
+ /* *
12
+ * Formatter for `boost::stacktrace::stacktrace` objects
13
+ *
14
+ * This class wraps `boost::stacktrace::stacktrace` objects and provides an operator<<
15
+ * for printing them to an `std::ostream` in a custom format.
16
+ */
11
17
class StackTraceFormatter {
12
18
public:
13
19
StackTraceFormatter (const boost::stacktrace::stacktrace &stack) : m_Stack(stack) {}
Original file line number Diff line number Diff line change 6
6
using namespace icinga ;
7
7
8
8
9
+ /* If you are reading this, you are probably doing so because this test case just failed. This might happen as it
10
+ * heavily depends on platform and compiler behavior. There are two likely causes why this could break:
11
+ *
12
+ * - Your compiler found new ways to optimize the functions that are called to create a stack, even though we tried
13
+ * to disable optimizations using #pragmas for some compilers. If you know a way to disable (more) optimizations for
14
+ * your compiler, you can try if this helps.
15
+ *
16
+ * - Boost fails to resolve symbol names as we've already seen on some platforms. In this case, you can try again
17
+ * passing the additional flag `-DICINGA2_STACKTRACE_USE_BACKTRACE_SYMBOLS=ON` to CMake and see if this helps.
18
+ *
19
+ * In any case, please report a bug. If you run `make CTEST_OUTPUT_ON_FAILURE=1 test`, the stack trace in question
20
+ * should be printed. If it looks somewhat meaningful, you can probably ignore a failure of this test case.
21
+ */
22
+
9
23
#pragma GCC push_options
10
24
#pragma GCC optimize ("O0")
11
25
#pragma clang optimize off
You can’t perform that action at this time.
0 commit comments