diff --git a/src/common/stabs_to_module.cc b/src/common/stabs_to_module.cc index 06f867e3..7731bc44 100644 --- a/src/common/stabs_to_module.cc +++ b/src/common/stabs_to_module.cc @@ -44,12 +44,16 @@ #include #include "common/stabs_to_module.h" +#include "common/language.h" namespace google_breakpad { // Demangle using abi call. // Older GCC may not support it. static std::string Demangle(const std::string& mangled) { + if (!Language::IsMangledName(mangled)) + return mangled; + int status = 0; char *demangled = abi::__cxa_demangle( mangled.c_str(), nullptr, nullptr, &status); diff --git a/src/common/stabs_to_module_unittest.cc b/src/common/stabs_to_module_unittest.cc index 3befb51c..11e540ea 100644 --- a/src/common/stabs_to_module_unittest.cc +++ b/src/common/stabs_to_module_unittest.cc @@ -214,9 +214,15 @@ TEST(FunctionNames, Mangled) { Module::Function *function = functions[0]; // This is GCC-specific, but we shouldn't be seeing STABS data anywhere // but Linux. +#ifdef _WIN32 +#define WHITESPACE_REGEX "\\s" +#else +#define WHITESPACE_REGEX "[[:space:]]" +#endif EXPECT_THAT(function->name.str(), ::testing::ContainsRegex( - "std::vector\\s?>::" + "std::vector" WHITESPACE_REGEX "?>::" "push_back\\(unsigned long long const&\\)")); +#undef WHITESPACE_REGEX EXPECT_EQ(0xf2cfda63cef7f46dLL, function->address); EXPECT_LT(0U, function->ranges[0].size); // should have used dummy size EXPECT_EQ(0U, function->parameter_size);