Index: src/common/dwarf_cu_to_module.cc |
diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc |
index 479e39b221250bf37a84cbd8ecdbb652825757e6..100f3962ae1d7454aea2a90216df596cbc9b3670 100644 |
--- a/src/common/dwarf_cu_to_module.cc |
+++ b/src/common/dwarf_cu_to_module.cc |
@@ -39,9 +39,6 @@ |
#include "common/dwarf_cu_to_module.h" |
#include <assert.h> |
-#if !defined(__ANDROID__) |
-#include <cxxabi.h> |
-#endif |
#include <inttypes.h> |
#include <stdint.h> |
#include <stdio.h> |
@@ -350,20 +347,22 @@ void DwarfCUToModule::GenericDIEHandler::ProcessAttributeString( |
case dwarf2reader::DW_AT_name: |
name_attribute_ = AddStringToPool(data); |
break; |
- case dwarf2reader::DW_AT_MIPS_linkage_name: { |
- char* demangled = NULL; |
- int status = -1; |
-#if !defined(__ANDROID__) // Android NDK doesn't provide abi::__cxa_demangle. |
- demangled = abi::__cxa_demangle(data.c_str(), NULL, NULL, &status); |
-#endif |
- if (status != 0) { |
- cu_context_->reporter->DemangleError(data, status); |
- demangled_name_ = ""; |
- break; |
- } |
- if (demangled) { |
- demangled_name_ = AddStringToPool(demangled); |
- free(reinterpret_cast<void*>(demangled)); |
+ case dwarf2reader::DW_AT_MIPS_linkage_name: |
+ case dwarf2reader::DW_AT_linkage_name: { |
+ string demangled; |
+ Language::DemangleResult result = |
+ cu_context_->language->DemangleName(data, &demangled); |
+ switch (result) { |
+ case Language::kDemangleSuccess: |
+ demangled_name_ = AddStringToPool(demangled); |
+ break; |
+ |
+ case Language::kDemangleFailure: |
+ cu_context_->reporter->DemangleError(data); |
+ // fallthrough |
+ case Language::kDontDemangle: |
+ demangled_name_.clear(); |
+ break; |
} |
break; |
} |
@@ -676,11 +675,10 @@ void DwarfCUToModule::WarningReporter::UnnamedFunction(uint64 offset) { |
filename_.c_str(), offset); |
} |
-void DwarfCUToModule::WarningReporter::DemangleError( |
- const string &input, int error) { |
+void DwarfCUToModule::WarningReporter::DemangleError(const string &input) { |
CUHeading(); |
- fprintf(stderr, "%s: warning: failed to demangle %s with error %d\n", |
- filename_.c_str(), input.c_str(), error); |
+ fprintf(stderr, "%s: warning: failed to demangle %s\n", |
+ filename_.c_str(), input.c_str()); |
} |
void DwarfCUToModule::WarningReporter::UnhandledInterCUReference( |
@@ -761,6 +759,7 @@ dwarf2reader::DIEHandler *DwarfCUToModule::FindChildHandler( |
case dwarf2reader::DW_TAG_class_type: |
case dwarf2reader::DW_TAG_structure_type: |
case dwarf2reader::DW_TAG_union_type: |
+ case dwarf2reader::DW_TAG_module: |
return new NamedScopeHandler(cu_context_.get(), child_context_.get(), |
offset); |
default: |
@@ -774,6 +773,10 @@ void DwarfCUToModule::SetLanguage(DwarfLanguage language) { |
cu_context_->language = Language::Java; |
break; |
+ case dwarf2reader::DW_LANG_Swift: |
+ cu_context_->language = Language::Swift; |
+ break; |
+ |
// DWARF has no generic language code for assembly language; this is |
// what the GNU toolchain uses. |
case dwarf2reader::DW_LANG_Mips_Assembler: |