Fix broken handling of nested namespaces.

- If multiple nested namespaces were involved in a name,
  GetFullyQualifiedDIEName() would erroneously wipe out each one
  as it walked up, leaving you with only the top level namespace.

- Don't touch the output parameter unless we're certain we succeeded.
This commit is contained in:
Rene Gollent
2011-12-10 16:57:05 -05:00
parent 216a2c7c89
commit 828294f3df
+10 -6
View File
@@ -176,12 +176,18 @@ DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry,
}
_name.Truncate(0);
BString generatedName;
// Get the namespace, if any.
DebugInfoEntry* parent = entry->Parent();
while (parent != NULL) {
if (parent->IsNamespace()) {
GetFullyQualifiedDIEName(parent, _name);
BString parentName;
GetFullyQualifiedDIEName(parent, parentName);
if (parentName.Length() > 0) {
parentName += "::";
generatedName.Prepend(parentName);
}
break;
}
@@ -190,14 +196,12 @@ DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry,
BString name;
GetFullDIEName(entry, name);
if (name.Length() == 0)
return;
if (_name.Length() > 0) {
_name << "::" << name;
} else
_name = name;
generatedName += name;
_name = generatedName;
}