Added StatementAtAddress() returning the statement at a given target address.

Needs optimization (iterates through all statements ATM).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31169 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-06-21 23:30:18 +00:00
parent 1df9bf1220
commit 49ad0141cf
2 changed files with 14 additions and 0 deletions

View File

@ -53,6 +53,19 @@ SourceCode::StatementAt(int32 index) const
} }
Statement*
SourceCode::StatementAtAddress(target_addr_t address) const
{
// TODO: Optimize!
for (int32 i = 0; Statement* statement = fStatements.ItemAt(i); i++) {
if (statement->ContainsAddress(address))
return statement;
}
return NULL;
}
bool bool
SourceCode::AddLine(const char* _line) SourceCode::AddLine(const char* _line)
{ {

View File

@ -24,6 +24,7 @@ public:
int32 CountStatements() const; int32 CountStatements() const;
Statement* StatementAt(int32 index) const; Statement* StatementAt(int32 index) const;
Statement* StatementAtAddress(target_addr_t address) const;
bool AddLine(const char* line); bool AddLine(const char* line);
// clones // clones