From db3342a10ec30902aa9018b80e1d9a40bd01c487 Mon Sep 17 00:00:00 2001 From: mmentovai Date: Tue, 5 Dec 2006 22:52:28 +0000 Subject: Module API (#32). r=waylonis, bryner - Introduces a standard API for dealing with modules. MinidumpModule is now a concrete implementation of this API. Code may interact with single modules using the CodeModule interface, and collections of modules using its container, the CodeModules interface. - CodeModule is used directly by SymbolSupplier implementations and SourceLineResolver. Reliance on the specific implementation in MinidumpModule has been eliminated. - Module lists are now added to ProcessState objects. Module references in each stack frame are now pointers to objects in these module lists. - The sample minidump_stackwalk tool prints the module list after printing all threads' stacks. http://groups.google.com/group/airbag-dev/browse_frm/thread/a9c0550edde54cf8 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@74 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/processor/range_map-inl.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/processor/range_map-inl.h') diff --git a/src/processor/range_map-inl.h b/src/processor/range_map-inl.h index 74ce8513..2ead2e65 100644 --- a/src/processor/range_map-inl.h +++ b/src/processor/range_map-inl.h @@ -141,6 +141,35 @@ bool RangeMap::RetrieveNearestRange( } +template +bool RangeMap::RetrieveRangeAtIndex( + int index, EntryType *entry, + AddressType *entry_base, AddressType *entry_size) const { + if (!entry || index >= GetCount()) + return false; + + // Walk through the map. Although it's ordered, it's not a vector, so it + // can't be addressed directly by index. + MapConstIterator iterator = map_.begin(); + for (int this_index = 0; this_index < index; ++this_index) + ++iterator; + + *entry = iterator->second.entry(); + if (entry_base) + *entry_base = iterator->first; + if (entry_size) + *entry_size = iterator->first - iterator->second.base() + 1; + + return true; +} + + +template +int RangeMap::GetCount() const { + return map_.size(); +} + + template void RangeMap::Clear() { map_.clear(); -- cgit v1.2.1