diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/language.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/language.cc b/src/common/language.cc index 978fb855..d26e5638 100644 --- a/src/common/language.cc +++ b/src/common/language.cc @@ -79,6 +79,18 @@ class CPPLanguage: public Language { demangled->clear(); return kDontDemangle; #else +#if defined(__APPLE__) + // Mac C++ symbols can have up to 4 underscores, followed by a "Z". + // Non-C++ symbols are not coded that way, but may have leading underscores. + // Attempting to demangle non-C++ symbols with the C++ demangler would print + // warnings and fail, so return kDontDemangle for these. + size_t i = mangled.find_first_not_of('_'); + if (i == 0 || i == string::npos || i > 4 || mangled[i] != 'Z') { + demangled->clear(); + return kDontDemangle; + } +#endif + int status; char* demangled_c = abi::__cxa_demangle(mangled.c_str(), NULL, NULL, &status); |