diff --git a/src/apps/debugger/dwarf/AttributeValue.h b/src/apps/debugger/dwarf/AttributeValue.h index f3b0ba22d5..e0b4e2de81 100644 --- a/src/apps/debugger/dwarf/AttributeValue.h +++ b/src/apps/debugger/dwarf/AttributeValue.h @@ -215,9 +215,9 @@ struct DeclarationLocation { DeclarationLocation() : - file(0), - line(0), - column(0) + file(0xffffffff), + line(0xffffffff), + column(0xffffffff) { } @@ -235,6 +235,21 @@ struct DeclarationLocation { { this->column = column; } + + bool IsFileSet() const + { + return file != 0xffffffff; + } + + bool IsLineSet() const + { + return line != 0xffffffff; + } + + bool IsColumnSet() const + { + return column != 0xffffffff; + } }; #endif // ATTRIBUTE_VALUE_H diff --git a/src/apps/debugger/dwarf/DebugInfoEntry.cpp b/src/apps/debugger/dwarf/DebugInfoEntry.cpp index a9d4b18a31..ee5d063d8a 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntry.cpp +++ b/src/apps/debugger/dwarf/DebugInfoEntry.cpp @@ -95,16 +95,39 @@ DebugInfoEntry::AbstractOrigin() const bool -DebugInfoEntry::GetDeclarationLocation(uint32& _file, uint32& _line, - uint32& _column) const +DebugInfoEntry::GetDeclarationFile(uint32& _file) const { DeclarationLocation* location = const_cast(this) ->GetDeclarationLocation(); - if (location == NULL) + if (location == NULL || !location->IsFileSet()) return false; _file = location->file; + return true; +} + + +bool +DebugInfoEntry::GetDeclarationLine(uint32& _line) const +{ + DeclarationLocation* location = const_cast(this) + ->GetDeclarationLocation(); + if (location == NULL || !location->IsLineSet()) + return false; + _line = location->line; + return true; +} + + +bool +DebugInfoEntry::GetDeclarationColumn(uint32& _column) const +{ + DeclarationLocation* location = const_cast(this) + ->GetDeclarationLocation(); + if (location == NULL || !location->IsColumnSet()) + return false; + _column = location->column; return true; } diff --git a/src/apps/debugger/dwarf/DebugInfoEntry.h b/src/apps/debugger/dwarf/DebugInfoEntry.h index ba048e4b53..cd9b7f5740 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntry.h +++ b/src/apps/debugger/dwarf/DebugInfoEntry.h @@ -59,8 +59,9 @@ public: virtual DebugInfoEntry* Specification() const; virtual DebugInfoEntry* AbstractOrigin() const; - bool GetDeclarationLocation(uint32& _file, - uint32& _line, uint32& _column) const; + bool GetDeclarationFile(uint32& _file) const; + bool GetDeclarationLine(uint32& _line) const; + bool GetDeclarationColumn(uint32& _column) const; virtual status_t AddChild(DebugInfoEntry* child); diff --git a/src/apps/debugger/dwarf/DwarfUtils.cpp b/src/apps/debugger/dwarf/DwarfUtils.cpp index d950f4a37b..be1f36b7b4 100644 --- a/src/apps/debugger/dwarf/DwarfUtils.cpp +++ b/src/apps/debugger/dwarf/DwarfUtils.cpp @@ -117,21 +117,33 @@ DwarfUtils::GetDeclarationLocation(DwarfFile* dwarfFile, uint32 file = 0; uint32 line = 0; uint32 column = 0; - entry->GetDeclarationLocation(file, line, column); + bool fileSet = entry->GetDeclarationFile(file); + bool lineSet = entry->GetDeclarationLine(line); + bool columnSet = entry->GetDeclarationColumn(column); - // if no info yet, try the abstract origin (if any) - if (file == 0) { + // if something is not set yet, try the abstract origin (if any) + if (!fileSet || !lineSet || !columnSet) { if (DebugInfoEntry* abstractOrigin = entry->AbstractOrigin()) { entry = abstractOrigin; - entry->GetDeclarationLocation(file, line, column); + if (!fileSet) + fileSet = entry->GetDeclarationFile(file); + if (!lineSet) + lineSet = entry->GetDeclarationLine(line); + if (!columnSet) + columnSet = entry->GetDeclarationColumn(column); } } - // if no info yet, try the specification (if any) - if (file == 0) { + // something is not set yet, try the specification (if any) + if (!fileSet || !lineSet || !columnSet) { if (DebugInfoEntry* specification = entry->Specification()) { entry = specification; - entry->GetDeclarationLocation(file, line, column); + if (!fileSet) + fileSet = entry->GetDeclarationFile(file); + if (!lineSet) + lineSet = entry->GetDeclarationLine(line); + if (!columnSet) + columnSet = entry->GetDeclarationColumn(column); } }