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:
@@ -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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user