Bug 1464537 - Fall back to the raw symbol name from DW_AT_MIPS_linkage_name when there is nothing else. r?ted
When DW_AT_MIPS_linkage_name doesn't demangle, breakpad currently throws
the symbol completely, but in some cases, there is no DW_AT_name or
DW_AT_abstract_origin to figure out a name, and the raw value from
DW_AT_MIPS_linkage_name is still better than nothing. Fall back to that
in when there is nothing else.
--- a/toolkit/crashreporter/google-breakpad/src/common/dwarf_cu_to_module.cc
+++ b/toolkit/crashreporter/google-breakpad/src/common/dwarf_cu_to_module.cc
@@ -283,16 +283,20 @@ class DwarfCUToModule::GenericDIEHandler
// The value of the DW_AT_name attribute, or the empty string if the
// DIE has no such attribute.
string name_attribute_;
// The demangled value of the DW_AT_MIPS_linkage_name attribute, or the empty
// string if the DIE has no such attribute or its content could not be
// demangled.
string demangled_name_;
+
+ // The non-demangled value of the DW_AT_MIPS_linkage_name attribute,
+ // it its content count not be demangled.
+ string raw_name_;
};
void DwarfCUToModule::GenericDIEHandler::ProcessAttributeUnsigned(
enum DwarfAttribute attr,
enum DwarfForm form,
uint64 data) {
switch (attr) {
case dwarf2reader::DW_AT_declaration: declaration_ = (data != 0); break;
@@ -355,16 +359,17 @@ void DwarfCUToModule::GenericDIEHandler:
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_ = "";
+ raw_name_ = AddStringToPool(data);
break;
}
if (demangled) {
demangled_name_ = AddStringToPool(demangled);
free(reinterpret_cast<void*>(demangled));
}
break;
}
@@ -389,16 +394,18 @@ string DwarfCUToModule::GenericDIEHandle
const string *enclosing_name;
if (!qualified_name) {
// Find the unqualified name. If the DIE has its own DW_AT_name
// attribute, then use that; otherwise, check the specification.
if (!name_attribute_.empty())
unqualified_name = &name_attribute_;
else if (specification_)
unqualified_name = &specification_->unqualified_name;
+ else if (!raw_name_.empty())
+ unqualified_name = &raw_name_;
// Find the name of the enclosing context. If this DIE has a
// specification, it's the specification's enclosing context that
// counts; otherwise, use this DIE's context.
if (specification_)
enclosing_name = &specification_->enclosing_name;
else
enclosing_name = &parent_context_->name;