aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/elf_symbols_to_module.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/linux/elf_symbols_to_module.cc')
-rw-r--r--src/common/linux/elf_symbols_to_module.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/linux/elf_symbols_to_module.cc b/src/common/linux/elf_symbols_to_module.cc
index 96c64fb6..562875e1 100644
--- a/src/common/linux/elf_symbols_to_module.cc
+++ b/src/common/linux/elf_symbols_to_module.cc
@@ -32,6 +32,7 @@
#include "common/linux/elf_symbols_to_module.h"
+#include <cxxabi.h>
#include <elf.h>
#include <string.h>
@@ -157,6 +158,16 @@ bool ELFSymbolsToModule(const uint8_t *symtab_section,
iterator->shndx != SHN_UNDEF) {
Module::Extern *ext = new Module::Extern(iterator->value);
ext->name = SymbolString(iterator->name_offset, strings);
+#if !defined(__ANDROID__) // Android NDK doesn't provide abi::__cxa_demangle.
+ int status = 0;
+ char* demangled =
+ abi::__cxa_demangle(ext->name.c_str(), NULL, NULL, &status);
+ if (demangled) {
+ if (status == 0)
+ ext->name = demangled;
+ free(demangled);
+ }
+#endif
module->AddExtern(ext);
}
++iterator;