* Get*DIEName(): Also follow abstract origins to get the name.

* GetDeclarationLocation():
  - Don't fail already when the entry itself doesn't support a declaration
    location, since that fails for inlined functions.
  - Follow abstract origin and specification, even if they don't have a have
    a declaration location. The latter doesn't matter in this case, but we
    failed erroneously, if the abstract origin had a specification which in
    turn had the declaration location info.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31399 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-07-03 21:04:46 +00:00
parent 15857c22d5
commit bc01feab3d
1 changed files with 43 additions and 21 deletions

View File

@ -14,12 +14,23 @@
/*static*/ void /*static*/ void
DwarfUtils::GetDIEName(const DebugInfoEntry* entry, BString& _name) DwarfUtils::GetDIEName(const DebugInfoEntry* entry, BString& _name)
{ {
// If we don't seem to have a name but a specification, return the // If we don't seem to have a name but an abstract origin, return the
// specification's name. // origin's name.
const char* name = entry->Name(); const char* name = entry->Name();
if (name == NULL) { if (name == NULL) {
if (DebugInfoEntry* specification = entry->Specification()) if (DebugInfoEntry* abstractOrigin = entry->AbstractOrigin()) {
name = specification->Name(); entry = abstractOrigin;
name = entry->Name();
}
}
// If we still don't have a name but a specification, return the
// specification's name.
if (name == NULL) {
if (DebugInfoEntry* specification = entry->Specification()) {
entry = specification;
name = entry->Name();
}
} }
_name = name; _name = name;
@ -29,13 +40,22 @@ 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)
{ {
// If we don't seem to have a name but a specification, return the // If we don't seem to have a name but an abstract origin, return the
// specification's name. // origin's name.
const char* name = entry->Name(); const char* name = entry->Name();
if (name == NULL) {
if (DebugInfoEntry* abstractOrigin = entry->AbstractOrigin()) {
entry = abstractOrigin;
name = entry->Name();
}
}
// If we still don't have a name but a specification, return the
// specification's name.
if (name == NULL) { if (name == NULL) {
if (DebugInfoEntry* specification = entry->Specification()) { if (DebugInfoEntry* specification = entry->Specification()) {
entry = specification; entry = specification;
name = specification->Name(); name = entry->Name();
} }
} }
@ -49,7 +69,14 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry, DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry,
BString& _name) BString& _name)
{ {
// If we don't seem to have a name but a specification, return the // If we don't seem to have a name but an abstract origin, return the
// origin's name.
if (entry->Name() == NULL) {
if (DebugInfoEntry* abstractOrigin = entry->AbstractOrigin())
entry = abstractOrigin;
}
// If we don't still don't have a name but a specification, get the
// specification's name. // specification's name.
if (entry->Name() == NULL) { if (entry->Name() == NULL) {
if (DebugInfoEntry* specification = entry->Specification()) if (DebugInfoEntry* specification = entry->Specification())
@ -87,29 +114,24 @@ DwarfUtils::GetDeclarationLocation(DwarfFile* dwarfFile,
const DebugInfoEntry* entry, const char*& _directory, const char*& _file, const DebugInfoEntry* entry, const char*& _directory, const char*& _file,
int32& _line, int32& _column) int32& _line, int32& _column)
{ {
uint32 file; uint32 file = 0;
uint32 line; uint32 line = 0;
uint32 column; uint32 column = 0;
if (!entry->GetDeclarationLocation(file, line, column)) entry->GetDeclarationLocation(file, line, column);
return false;
// if no info yet, try the abstract origin (if any) // if no info yet, try the abstract origin (if any)
if (file == 0) { if (file == 0) {
if (DebugInfoEntry* abstractOrigin = entry->AbstractOrigin()) { if (DebugInfoEntry* abstractOrigin = entry->AbstractOrigin()) {
if (abstractOrigin->GetDeclarationLocation(file, line, column) entry = abstractOrigin;
&& file != 0) { entry->GetDeclarationLocation(file, line, column);
entry = abstractOrigin;
}
} }
} }
// if no info yet, try the specification (if any) // if no info yet, try the specification (if any)
if (file == 0) { if (file == 0) {
if (DebugInfoEntry* specification = entry->Specification()) { if (DebugInfoEntry* specification = entry->Specification()) {
if (specification->GetDeclarationLocation(file, line, column) entry = specification;
&& file != 0) { entry->GetDeclarationLocation(file, line, column);
entry = specification;
}
} }
} }