Additional sanity checking.
Also ensure that the return parameter isn't touched unless we definitely succeeded.
This commit is contained in:
@@ -42,6 +42,7 @@ DwarfUtils::GetDIEName(const DebugInfoEntry* entry, BString& _name)
|
|||||||
/*static*/ void
|
/*static*/ void
|
||||||
DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
|
DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
|
||||||
{
|
{
|
||||||
|
BString generatedName;
|
||||||
// If we don't seem to have a name but an abstract origin, return the
|
// If we don't seem to have a name but an abstract origin, return the
|
||||||
// origin's name.
|
// origin's name.
|
||||||
const char* name = entry->Name();
|
const char* name = entry->Name();
|
||||||
@@ -61,13 +62,17 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_name = name;
|
// we found no name for this entry whatsoever, abort.
|
||||||
|
if (name == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
generatedName = name;
|
||||||
|
|
||||||
const DIESubprogram* subProgram = dynamic_cast<const DIESubprogram*>(
|
const DIESubprogram* subProgram = dynamic_cast<const DIESubprogram*>(
|
||||||
entry);
|
entry);
|
||||||
if (subProgram != NULL) {
|
if (subProgram != NULL) {
|
||||||
// TODO: retrieve template parameters
|
// TODO: retrieve template parameters
|
||||||
_name += "(";
|
generatedName += "(";
|
||||||
BString parameters;
|
BString parameters;
|
||||||
DebugInfoEntryList::ConstIterator iterator
|
DebugInfoEntryList::ConstIterator iterator
|
||||||
= subProgram->Parameters().GetIterator();
|
= subProgram->Parameters().GetIterator();
|
||||||
@@ -81,8 +86,10 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
|
|||||||
while (iterator.HasNext()) {
|
while (iterator.HasNext()) {
|
||||||
const DIEFormalParameter* parameter
|
const DIEFormalParameter* parameter
|
||||||
= dynamic_cast<DIEFormalParameter*>(iterator.Next());
|
= dynamic_cast<DIEFormalParameter*>(iterator.Next());
|
||||||
if (parameter == NULL)
|
if (parameter == NULL) {
|
||||||
continue;
|
// this shouldn't happen
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BString paramName;
|
BString paramName;
|
||||||
BString modifier;
|
BString modifier;
|
||||||
@@ -124,12 +131,13 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.Length() > 0)
|
if (parameters.Length() > 0)
|
||||||
_name += parameters;
|
generatedName += parameters;
|
||||||
else
|
else
|
||||||
_name += "void";
|
generatedName += "void";
|
||||||
_name += ")";
|
generatedName += ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_name = generatedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user