Roll back the cxxabi demangle _Z check

This commit is contained in:
Jeremy Rifkin 2025-02-02 18:32:15 -06:00
parent b2180ae797
commit 8e7b4a953f
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4

View File

@ -14,11 +14,12 @@
namespace cpptrace {
namespace detail {
std::string demangle(const std::string& name) {
// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#demangler
// check both _Z and __Z, apple prefixes all symbols with an underscore
if(!(starts_with(name, "_Z") || starts_with(name, "__Z"))) {
return name;
}
// TODO: Do a special check to ensure external names start with _Z?
// // https://itanium-cxx-abi.github.io/cxx-abi/abi.html#demangler
// // check both _Z and __Z, apple prefixes all symbols with an underscore
// if(!(starts_with(name, "_Z") || starts_with(name, "__Z"))) {
// return name;
// }
// Apple clang demangles __Z just fine but gcc doesn't, so just offset the leading underscore
std::size_t offset = 0;
if(starts_with(name, "__Z")) {