]> git.siccegge.de Git - frida/frida.git/blobdiff - src/core/InformationManager.cxx
Implement InformationManager / Comment and ChangeCommentEvent
[frida/frida.git] / src / core / InformationManager.cxx
index e1571892349336ab5d0cc94f1d64104d64428d68..8834a7a39f479b49a0d9b9dad115eaf7269d33cc 100644 (file)
@@ -5,6 +5,7 @@
 #include "core/BasicBlock.hxx"
 #include "core/Comment.hxx"
 #include "core/events/NewFunctionEvent.hxx"
+#include "core/events/ChangeCommentEvent.hxx"
 
 #include "gui/qt.hxx"
 #include <quazip/quazip.h>
@@ -160,6 +161,22 @@ std::map<uint64_t, BasicBlock*>::const_iterator InformationManager::endBasicBloc
        return blocks.end();
 }
 
+/* *********************************
+ * Accessors for the Comments map
+ */
+std::pair<
+       std::multimap<uint64_t, Comment*>::const_iterator,
+       std::multimap<uint64_t, Comment*>::const_iterator>
+InformationManager::getComments(uint64_t address) {
+       return comments.equal_range(address);
+}
+
+std::multimap<uint64_t, Comment*>::const_iterator InformationManager::beginComments() {
+       return comments.begin();
+}
+std::multimap<uint64_t, Comment*>::const_iterator InformationManager::endComments() {
+       return comments.end();
+}
 
 /* *********************************
  * Accessors for the Interpreter map
@@ -210,7 +227,7 @@ Comment* InformationManager::newGlobalComment(uint64_t address) {
 }
 
 Comment* InformationManager::newLocalComment(uint64_t address, Function* f) {
-       Comment* comment = new Comment(address, this);
+       Comment* comment = new Comment(address, f, this);
        comments.insert(std::make_pair(address, comment));
        return comment;
 }
@@ -228,7 +245,10 @@ void InformationManager::finishFunction(Function* fun) {
 void InformationManager::finishBasicBlock(BasicBlock*) {
 }
 
-void InformationManager::finnishComment(Comment* c) {
+void InformationManager::finishComment(Comment* c) {
+       LOG4CXX_DEBUG(logger, "Finishing comment " << c->getAddress());
+       ChangeCommentEvent event(c->getAddress(), c->getLocation(), c);
+       dispatch(&event);
 }
 
 void InformationManager::deleteFunction(Function* f) {