X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fcore%2FInformationManager.hxx;h=03cb3b866ec139b875ffad8a7556820b3733c2e1;hp=5d2ef64c67342f98cfddd2805d36335c0cfc22b0;hb=0daf9a157f3d41690cf4a0287db1adecc4ad0b71;hpb=231dae075375e7d57982f5107b86294fbe726b33 diff --git a/src/core/InformationManager.hxx b/src/core/InformationManager.hxx index 5d2ef64..03cb3b8 100644 --- a/src/core/InformationManager.hxx +++ b/src/core/InformationManager.hxx @@ -3,41 +3,91 @@ #include #include +#include +#include class Disassembler; class Function; +class BasicBlock; +class Comment; + +class QString; + +class RenameFunctionEvent; class InformationManager { public: + ~InformationManager(); + + void reset(const std::string& filename); + void save(const QString& filename); + + void signal_new_function(Function* f); + void signal_new_dyn_symbol(const std::string& f) + { new_dyn_symbol_signal(f); } + boost::signals2::connection - connect_new_function_signal(std::function f) { - return new_function_signal.connect(f); - } + connect_new_function_signal(std::function f) + { return new_function_signal.connect(f); } - void signal_new_function(Function* f) { - new_function_signal(f); - } + boost::signals2::connection + connect_new_dyn_symbol_signal(std::function f) + { return new_dyn_symbol_signal.connect(f); } boost::signals2::connection - connect_reset_signal(std::function f) { - return reset_signal.connect(f); - } + connect_reset_signal(std::function f) + { return reset_signal.connect(f); } - // boost::signals2::connection - // connect_information_added_signal(uint64_t begin, uint64_t end, - // std::function) { + boost::signals2::connection + connect_rename_function_signal(std::function f) + { return rename_function_signal.connect(f); } - // } + Disassembler* getDisassembler() + { return disassembler.get(); } - Disassembler* getDisassembler() { - return disassembler.get(); - } + void dispatch(RenameFunctionEvent* event) + { rename_function_signal(event); } - void reset(const std::string& filename); + Function* getFunction(uint64_t address); + BasicBlock* getBasicBlock(uint64_t address); + + /* Protocoll: + * + * Users may allocate new Data containers with the new*() + * functions. Once they have populated the information they hand + * over the object to the information manager using the finish*() + * functions. + * + * if new*() returns NULL there already exists a function at the + * specified address. Users may then get the old object if they + * wish or (more likely) skip creating it. Uniqueness of the + * object is only guaranteed as compared to the finish()ed + * objects. + * + * Users are responsible for destroying functions iff they do not + * finish them using the delete*() functions. Once the objects are + * finished, the information manager is responsible for cleaning + * up the memory. If delete*() is called on a finished object, bad + * thingsmay happen. + */ + Function* newFunction(uint64_t address); + BasicBlock* newBasicBlock(uint64_t address); + Comment* newGlobalComment(uint64_t address); + Comment* newLocalComment(uint64_t address, Function* f); + void finishFunction(Function* f); + void finishBasicBlock(BasicBlock* b); + void finnishComment(Comment* c); + void deleteFunction(Function* f); + void deleteBasicBlock(BasicBlock* b); + void deleteComment(Comment* c); private: boost::signals2::signal reset_signal; boost::signals2::signal new_function_signal; + boost::signals2::signal new_dyn_symbol_signal; + boost::signals2::signal rename_function_signal; std::unique_ptr disassembler; + std::map functions; + std::map blocks; }; #endif /* INCLUDE__InformationManager_hxx */