[Haiku-commits] r31169 - haiku/trunk/src/apps/debugger/model
bonefish at BerliOS
bonefish at mail.berlios.de
Mon Jun 22 01:30:19 CEST 2009
Author: bonefish
Date: 2009-06-22 01:30:18 +0200 (Mon, 22 Jun 2009)
New Revision: 31169
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31169&view=rev
Modified:
haiku/trunk/src/apps/debugger/model/SourceCode.cpp
haiku/trunk/src/apps/debugger/model/SourceCode.h
Log:
Added StatementAtAddress() returning the statement at a given target address.
Needs optimization (iterates through all statements ATM).
Modified: haiku/trunk/src/apps/debugger/model/SourceCode.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/model/SourceCode.cpp 2009-06-21 23:28:13 UTC (rev 31168)
+++ haiku/trunk/src/apps/debugger/model/SourceCode.cpp 2009-06-21 23:30:18 UTC (rev 31169)
@@ -53,6 +53,19 @@
}
+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)
{
Modified: haiku/trunk/src/apps/debugger/model/SourceCode.h
===================================================================
--- haiku/trunk/src/apps/debugger/model/SourceCode.h 2009-06-21 23:28:13 UTC (rev 31168)
+++ haiku/trunk/src/apps/debugger/model/SourceCode.h 2009-06-21 23:30:18 UTC (rev 31169)
@@ -24,6 +24,7 @@
int32 CountStatements() const;
Statement* StatementAt(int32 index) const;
+ Statement* StatementAtAddress(target_addr_t address) const;
bool AddLine(const char* line);
// clones
More information about the Haiku-commits
mailing list