diff options
author | Bernard Normier <bernard@zeroc.com> | 2017-06-13 18:39:01 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2017-06-13 18:39:01 +0000 |
commit | 3a01e6d1144a522c1b3ccd6f517e842d94252312 (patch) | |
tree | 43abba118c55754a3f2e9518f4ac53b40d0dd232 /cpp/src/IceUtil/UtilException.cpp | |
parent | Update mcpp/lmdb NuGet packages (diff) | |
download | ice-3a01e6d1144a522c1b3ccd6f517e842d94252312.tar.bz2 ice-3a01e6d1144a522c1b3ccd6f517e842d94252312.tar.xz ice-3a01e6d1144a522c1b3ccd6f517e842d94252312.zip |
Work-around for backtrace_pcinfo thread init bug, see ICE-8036
Diffstat (limited to 'cpp/src/IceUtil/UtilException.cpp')
-rw-r--r-- | cpp/src/IceUtil/UtilException.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/cpp/src/IceUtil/UtilException.cpp b/cpp/src/IceUtil/UtilException.cpp index 3c85b32ed53..030950c9dde 100644 --- a/cpp/src/IceUtil/UtilException.cpp +++ b/cpp/src/IceUtil/UtilException.cpp @@ -119,6 +119,13 @@ ignoreErrorCallback(void*, const char* msg, int errnum) // cerr << "Error callback: " << msg << ", errnum = " << errnum << endl; } +int +ignoreFrame(void*, uintptr_t pc, const char*, int, const char*) +{ + assert(pc == 0); + return 0; +} + #endif class Init @@ -132,6 +139,13 @@ public: // Leaked, as libbacktrace does not provide an API to free // this state bstate = backtrace_create_state(0, 1, ignoreErrorCallback, 0); + + // The first call to backtrace_pcinfo initializes bstate->fileline_fn, apparently + // not in a thread-safe manner (at least with GCC 5.4.0 on Ubuntu Xenial). + // See ICE-8036. So we make a "dummy" call to backtrace_pcinfo here for + // this extra initialization. + // + backtrace_pcinfo(bstate, 0, ignoreFrame, ignoreErrorCallback, 0); #endif } @@ -290,8 +304,6 @@ printFrame(void* data, uintptr_t pc, const char* filename, int lineno, const cha void handlePcInfoError(void* data, const char* msg, int errnum) { - // cerr << "pcinfo error callback: " << msg << ", " << errnum << endl; - FrameInfo& frameInfo = *reinterpret_cast<FrameInfo*>(data); printFrame(&frameInfo, frameInfo.pc, 0, 0, 0); frameInfo.setByErrorCb = true; |