Demangle symbol name

The spec says it should be demangled.
https://code.google.com/p/google-breakpad/wiki/SymbolFiles

BUG=chromium:453498
R=mark@chromium.org

Review URL: https://breakpad.appspot.com/2854002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1421 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
hashimoto@chromium.org 2015-02-03 03:17:30 +00:00
parent 4c01a9c389
commit 9f00bce09a
2 changed files with 12 additions and 1 deletions

View file

@ -352,7 +352,7 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeString(
case dwarf2reader::DW_AT_MIPS_linkage_name: { case dwarf2reader::DW_AT_MIPS_linkage_name: {
char* demangled = NULL; char* demangled = NULL;
int status = -1; int status = -1;
#if !defined(__ANDROID__) #if !defined(__ANDROID__) // Android NDK doesn't provide abi::__cxa_demangle.
demangled = abi::__cxa_demangle(data.c_str(), NULL, NULL, &status); demangled = abi::__cxa_demangle(data.c_str(), NULL, NULL, &status);
#endif #endif
if (status != 0) { if (status != 0) {

View file

@ -32,6 +32,7 @@
#include "common/linux/elf_symbols_to_module.h" #include "common/linux/elf_symbols_to_module.h"
#include <cxxabi.h>
#include <elf.h> #include <elf.h>
#include <string.h> #include <string.h>
@ -157,6 +158,16 @@ bool ELFSymbolsToModule(const uint8_t *symtab_section,
iterator->shndx != SHN_UNDEF) { iterator->shndx != SHN_UNDEF) {
Module::Extern *ext = new Module::Extern(iterator->value); Module::Extern *ext = new Module::Extern(iterator->value);
ext->name = SymbolString(iterator->name_offset, strings); 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); module->AddExtern(ext);
} }
++iterator; ++iterator;