-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Description
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.
Line 149 in 1b18321
| fbstring demangle(const char* name) { |
In the 1st version, we try libiberty, spelled as liberty in the code. And if not found, try cxxabi.
Line 221 in 1b18321
| 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.