* DebugInfoEntry: Allow access to the individual declaration location
attributes returning for each whether it was set on the entry. * DwarfUtils::GetDeclarationLocation(): Entries can just override individual declaration location attributes. E.g. for a specification entry file, line, and column can be given, while the entry for the implementation could just override the line, if it is implemented in the same file (like inline methods in a header). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31493 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<DebugInfoEntry*>(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<DebugInfoEntry*>(this)
|
||||
->GetDeclarationLocation();
|
||||
if (location == NULL || !location->IsLineSet())
|
||||
return false;
|
||||
|
||||
_line = location->line;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DebugInfoEntry::GetDeclarationColumn(uint32& _column) const
|
||||
{
|
||||
DeclarationLocation* location = const_cast<DebugInfoEntry*>(this)
|
||||
->GetDeclarationLocation();
|
||||
if (location == NULL || !location->IsColumnSet())
|
||||
return false;
|
||||
|
||||
_column = location->column;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user