mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-03-06 15:29:56 +00:00
mac: Don’t try to demangle non-C++ symbols with the C++ demangler
On Mac a C++ symbol has 1-4 underscore characters followed by a 'Z'. Symbols that do not have this format (such as plain C symbols) causes a lot of warnings to be printed. Bug: chromium:1062556 Change-Id: I55977f756c7e20cc5e7b1cb8e38316d7bf1f748c Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2179482 Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
a7b621f810
commit
2ffe116322
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue