diff --git a/src/apps/debugger/model/SourceCode.cpp b/src/apps/debugger/model/SourceCode.cpp index d93fb2062b..f38bfe94e6 100644 --- a/src/apps/debugger/model/SourceCode.cpp +++ b/src/apps/debugger/model/SourceCode.cpp @@ -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 SourceCode::AddLine(const char* _line) { diff --git a/src/apps/debugger/model/SourceCode.h b/src/apps/debugger/model/SourceCode.h index cd81ce27a8..c106283178 100644 --- a/src/apps/debugger/model/SourceCode.h +++ b/src/apps/debugger/model/SourceCode.h @@ -24,6 +24,7 @@ public: int32 CountStatements() const; Statement* StatementAt(int32 index) const; + Statement* StatementAtAddress(target_addr_t address) const; bool AddLine(const char* line); // clones