From da6713066e129dad4438885818d161c5a675608b Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 12 Oct 2026 21:05:46 +0200 Subject: [PATCH 1/2] src/common/stabs_to_module_unittest: use POSIX regex on POSIX systems in STABS unit test The failure was observed on FreeBSD. Use POSIX-compatible regex syntax on POSIX systems while preserving compatibility with Windows' regex implementation. --- src/common/stabs_to_module_unittest.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); From 37abbfacb95ebcf69a1ffd1e588cdfb4ac1de7db Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Mon, 12 Oct 2026 22:17:53 +0200 Subject: [PATCH 2/2] src/common/stabs_to_module: check mangled names before demangling STABS symbols The failure was observed on FreeBSD, but checking whether a name is mangled before demangling it is a platform-independent robustness improvement. --- src/common/stabs_to_module.cc | 4 ++++ 1 file changed, 4 insertions(+) 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);