Skip to content

Symbolizer does not demangle function names if binutils-dev is not installed before compiling folly #2546

@0xE1E10

Description

@0xE1E10

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions