icinga2/lib/base/stacktrace.hpp
Julian Brost b931194f59 Use backtrace_symbols() when printing stack traces on FreeBSD
Unfortunately, the symbol resolution of boost::stacktrace is broken on
FreeBSD, therefore fall back to using backtrace_symbols() to print the
stack trace saved by Boost.

Additionally, -D_GNU_SOURCE is required on FreeBSD for the
_Unwind_Backtrace function used by boost::stacktrace.
2021-03-01 14:07:09 +01:00

26 lines
513 B
C++

/* Icinga 2 | (c) 2020 Icinga GmbH | GPLv2+ */
#ifndef STACKTRACE_H
#define STACKTRACE_H
#include <boost/stacktrace.hpp>
namespace icinga
{
class StackTraceFormatter {
public:
StackTraceFormatter(const boost::stacktrace::stacktrace &stack) : m_Stack(stack) {}
private:
const boost::stacktrace::stacktrace &m_Stack;
friend std::ostream &operator<<(std::ostream &os, const StackTraceFormatter &f);
};
std::ostream& operator<<(std::ostream& os, const StackTraceFormatter &f);
}
#endif /* STACKTRACE_H */