We have 2 versions of demangle() in Demangle.h:
fbstring demangle(const char* name);
size_t demangle(const char* name, char* out, size_t outSize);
The only difference is supposed to be that one allocates new string while the other uses your provided buffer. (Potentially reused or memory pooled and therefore more efficient.) But that's not what actually happens.
|
fbstring demangle(const char* name) { |
In the 1st version, we try libiberty, spelled as liberty in the code. And if not found, try cxxabi.
|
size_t demangle(const char* name, char* out, size_t outSize) { |
We don't do that in the 2nd version.
Note that the function actually does allow using provided buffer. We just choose to set it to nullptr to get new buffer. https://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00026.html#aaf2180d3f67420d4e937e85b281b94a0
In Symbolizer, we call the 1st version.
|
demangle(frame.name, demangledBuf, sizeof(demangledBuf)); |
Other Facebook projects such as Velox rely on this code to print stack trace. So all test logs are unreadable unless you install binutils-dev and recompile folly first.
We have 2 versions of demangle() in Demangle.h:
The only difference is supposed to be that one allocates new string while the other uses your provided buffer. (Potentially reused or memory pooled and therefore more efficient.) But that's not what actually happens.
folly/folly/Demangle.cpp
Line 149 in 1b18321
In the 1st version, we try libiberty, spelled as liberty in the code. And if not found, try cxxabi.
folly/folly/Demangle.cpp
Line 221 in 1b18321
We don't do that in the 2nd version.
Note that the function actually does allow using provided buffer. We just choose to set it to nullptr to get new buffer. https://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00026.html#aaf2180d3f67420d4e937e85b281b94a0
In Symbolizer, we call the 1st version.
folly/folly/debugging/symbolizer/SymbolizePrinter.cpp
Line 156 in a6cd099
Other Facebook projects such as Velox rely on this code to print stack trace. So all test logs are unreadable unless you install binutils-dev and recompile folly first.