aboutsummaryrefslogtreecommitdiffstats
path: root/src/debug.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-03-04 05:59:08 +0100
committerSven Gothel <[email protected]>2022-03-04 05:59:08 +0100
commit8117471a5e35346ed674d3efc7800be91dbf3d2d (patch)
tree07b781ad986e2560173c3c55909ad07c729e74c6 /src/debug.cpp
parent2270f7d243b39c2d35d73e9d8776c88460222759 (diff)
SIGSEGV workaround in jau::get_backtrace(..) of libunwind [1.3 - 1.6.2]'s unw_step(..) using g++ 10.2.1 aarch64: Disable Optimization
Diffstat (limited to 'src/debug.cpp')
-rw-r--r--src/debug.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/debug.cpp b/src/debug.cpp
index 65c54a3..acc77a7 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -33,6 +33,16 @@
using namespace jau;
+/**
+ * On aarch64 using g++ (Debian 10.2.1-6) 10.2.1 20210110
+ * optimization of `jau::get_backtrace(..)` leads to a SIGSEGV
+ * on libunwind version [1.3 - 1.6.2] function `unw_step(..)`
+ */
+#if defined(__GNUC__) && ! defined(__clang__)
+ #pragma GCC push_options
+ #pragma GCC optimize("-O0")
+#endif
+
std::string jau::get_backtrace(const bool skip_anon_frames, const jau::snsize_t max_frames, const jau::snsize_t skip_frames) noexcept {
// symbol:
// 1: _ZN9direct_bt10DBTAdapter14startDiscoveryEbNS_19HCILEOwnAddressTypeEtt + 0x58d @ ip 0x7faa959d6daf, sp 0x7ffe38f301e0
@@ -101,6 +111,10 @@ std::string jau::get_backtrace(const bool skip_anon_frames, const jau::snsize_t
return out;
}
+#if defined(__GNUC__) && ! defined(__clang__)
+ #pragma GCC pop_options
+#endif
+
void jau::print_backtrace(const bool skip_anon_frames, const jau::snsize_t max_frames, const jau::snsize_t skip_frames) noexcept {
fprintf(stderr, "%s", get_backtrace(skip_anon_frames, max_frames, skip_frames).c_str());
fflush(stderr);