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); _name.Truncate(0);
BString generatedName;
// Get the namespace, if any. // Get the namespace, if any.
DebugInfoEntry* parent = entry->Parent(); DebugInfoEntry* parent = entry->Parent();
while (parent != NULL) { while (parent != NULL) {
if (parent->IsNamespace()) { if (parent->IsNamespace()) {
GetFullyQualifiedDIEName(parent, _name); BString parentName;
GetFullyQualifiedDIEName(parent, parentName);
if (parentName.Length() > 0) {
parentName += "::";
generatedName.Prepend(parentName);
}
break; break;
} }
@@ -190,14 +196,12 @@ DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry,
BString name; BString name;
GetFullDIEName(entry, name); GetFullDIEName(entry, name);
if (name.Length() == 0) if (name.Length() == 0)
return; return;
if (_name.Length() > 0) { generatedName += name;
_name << "::" << name;
} else _name = generatedName;
_name = name;
} }