From: Christoph Egger Date: Thu, 12 Mar 2015 12:45:41 +0000 (+0100) Subject: Complete accessors for InformationManager managed objects X-Git-Tag: v0.1~44 X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=3d7b4d3a5f6c17823bb79490256661ddb5e7ab83;p=frida%2Ffrida.git Complete accessors for InformationManager managed objects --- diff --git a/src/core/InformationManager.cxx b/src/core/InformationManager.cxx index 711d47a..61daa3d 100644 --- a/src/core/InformationManager.cxx +++ b/src/core/InformationManager.cxx @@ -112,6 +112,12 @@ void InformationManager::save(const std::string& filename) { void InformationManager::signal_new_function(Function* fun) { } + + +/* ******************************* + * Accessors for the Functions map + */ + Function* InformationManager::getFunction(uint64_t address) { auto it = functions.find(address); if (it != functions.end()) @@ -120,6 +126,18 @@ Function* InformationManager::getFunction(uint64_t address) { return NULL; } +std::map::const_iterator InformationManager::beginFunctions() { + return functions.begin(); +} +std::map::const_iterator InformationManager::endFunctions() { + return functions.end(); +} + + +/* ********************************* + * Accessors for the BasicBlocks map + */ + BasicBlock* InformationManager::getBasicBlock(uint64_t address) { auto it = blocks.find(address); if (it != blocks.end()) @@ -128,6 +146,19 @@ BasicBlock* InformationManager::getBasicBlock(uint64_t address) { return NULL; } +std::map::const_iterator InformationManager::beginBasicBlocks() { + return blocks.begin(); +} +std::map::const_iterator InformationManager::endBasicBlocks() { + return blocks.end(); +} + + + +/* ******************************** + * Factory methods for data classes + */ + Function* InformationManager::newFunction(uint64_t address) { Function* fun = new Function(address, this); functions.insert(std::make_pair(address, fun)); diff --git a/src/core/InformationManager.hxx b/src/core/InformationManager.hxx index 86e4d8c..555070a 100644 --- a/src/core/InformationManager.hxx +++ b/src/core/InformationManager.hxx @@ -13,11 +13,11 @@ class Function; class BasicBlock; class Comment; +class RenameFunctionEvent; + class QString; class QTemporaryFile; -class RenameFunctionEvent; - class InformationManager { public: InformationManager(); @@ -53,9 +53,17 @@ public: void dispatch(RenameFunctionEvent* event) { rename_function_signal(event); } + Function* getFunction(uint64_t address); - BasicBlock* getBasicBlock(uint64_t address); bool hasFunctions() const {return functions.size() != 0;} + std::map::const_iterator beginFunctions(); + std::map::const_iterator endFunctions(); + + BasicBlock* getBasicBlock(uint64_t address); + bool hasBasicBlocks() const {return blocks.size() != 0;} + std::map::const_iterator beginBasicBlocks(); + std::map::const_iterator endBasicBlocks(); + /* Protocoll: *