-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ABI demangling for the GCC 5.x case. #50
Conversation
When glog is compiled with gcc-5.2 in cxx11 ABI mode, it barfs about unmangled symbols. This patches it getting inspiration from binutils and demangle.cc itself, although it may be totally wrong or maybe have to use ParseAbiTag in more places. I haven't read the spec for the symbols, though. This patch makes the demangle unit test pass correctly.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
Hey, yo! |
CLAs look good, thanks! |
This probably fixes #14 as well. |
no unittest? |
I applied #50 on an aarch64 system with GCC 5.4.0, and all tests related to demangling passed. |
Sorry, @ukai. No unittests for now. I made this patch a looong time ago and I'm not affected by this bug anymore. Moreover, I don't have bandwidth at this time to revisit this. :-( |
@Jo-Con-El @ukai - where would unit tests go, if they were to exist? I am on a system where this patch matters, and it would be very useful to have it accepted. |
I think you'll want to add symbols to https://github.com/google/glog/blob/master/src/demangle_unittest.txt |
I tried to add a test but it fails diff --git a/src/demangle_unittest.cc b/src/demangle_unittest.cc
index be48341..c51371a 100644
--- a/src/demangle_unittest.cc
+++ b/src/demangle_unittest.cc
@@ -111,6 +111,8 @@ TEST(Demangle, Clones) {
EXPECT_STREQ("Foo()", tmp);
EXPECT_TRUE(Demangle("_ZL3Foov.isra.2.constprop.18", tmp, sizeof(tmp)));
EXPECT_STREQ("Foo()", tmp);
+ EXPECT_TRUE(Demangle("_Z3fooB5cxx11", tmp, sizeof(tmp)));
+ EXPECT_STREQ("foo[abi:cxx11]", tmp);
// Invalid (truncated), should not demangle.
EXPECT_FALSE(Demangle("_ZL3Foov.clo", tmp, sizeof(tmp)));
// Invalid (.clone. not followed by number), should not demangle. although it's working in GCC #include <stdio.h>
#include <stdlib.h>
#include <cxxabi.h>
int main() {
const char *mangled_name = "_Z3fooB5cxx11";
char *demangled_name;
int status = -1;
demangled_name = abi::__cxa_demangle(mangled_name, NULL, NULL, &status);
printf("Demangled: %s\n", demangled_name);
free(demangled_name);
return 0;
} |
Support ABI tags after <local-source-name> in demangle.cc. Update the reference URL. Fixes google#50
When glog is compiled with gcc-5.2 in cxx11 ABI mode, it barfs about unmangled symbols. This patches it getting inspiration from binutils and demangle.cc itself, although it may be totally wrong or maybe have to use ParseAbiTag in more places. I haven't read the spec for the symbols, though.
Symbols are demangled now as
This patch makes the demangle unit test pass correctly (as there's no more symbols starting with _Z), so closes #40.