diff options
Diffstat (limited to 'src/libutil/fmt.cc')
-rw-r--r-- | src/libutil/fmt.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libutil/fmt.cc b/src/libutil/fmt.cc index 400fb7ea0..bff5af020 100644 --- a/src/libutil/fmt.cc +++ b/src/libutil/fmt.cc @@ -1,4 +1,9 @@ #include "fmt.hh" // IWYU pragma: keep +// Darwin and FreeBSD stdenv do not define _GNU_SOURCE but do have _Unwind_Backtrace. +#if __APPLE__ || __FreeBSD__ +#define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED +#endif +#include <boost/stacktrace/stacktrace.hpp> template class boost::basic_format<char>; @@ -11,4 +16,9 @@ template HintFmt::HintFmt(const std::string &, const uint64_t &, const char * co HintFmt::HintFmt(const std::string & literal) : HintFmt("%s", Uncolored(literal)) {} +void printStackTrace() +{ + std::cerr << boost::stacktrace::stacktrace() << std::endl; +} + } |