#include <quazip/quazip.h>
#include <quazip/quazipfile.h>
+InformationManager::~InformationManager() {
+ for (BasicBlock * b : blocks)
+ delete b;
+
+ for (Function * f : functions)
+ delete f;
+}
+
void InformationManager::reset(const std::string& filename) {
disassembler.reset(createLLVMDisassembler(filename, this));
if (disassembler.get() != NULL)
zip.close();
}
+
+void InformationManager::signal_new_function(Function* fun) {
+ functions.insert(fun);
+ for (auto b : fun->blocks())
+ blocks.insert(b.second);
+ new_function_signal(fun);
+}
class InformationManager {
public:
+ ~InformationManager();
+
void reset(const std::string& filename);
void save(const QString& filename);
+ void signal_new_function(Function* f);
+
boost::signals2::connection
connect_new_function_signal(std::function<void(Function*)> f)
{ return new_function_signal.connect(f); }
- void signal_new_function(Function* f)
- { functions.insert(f); new_function_signal(f); }
+
boost::signals2::connection
connect_new_dyn_symbol_signal(std::function<void(const std::string& name)> f)
boost::signals2::signal<void (const std::string& name)> new_dyn_symbol_signal;
std::unique_ptr<Disassembler> disassembler;
std::set<Function*> functions;
+ std::set<BasicBlock*> blocks;
};
#endif /* INCLUDE__InformationManager_hxx */
template <typename ELFT>
LLVMDisassembler<ELFT>::~LLVMDisassembler() {
- std::for_each(functions.begin(), functions.end(),
- [](std::pair<uint64_t,LLVMFunction*> it) {
- delete it.second;
- });
- std::for_each(blocks.begin(), blocks.end(),
- [](std::pair<uint64_t, LLVMBasicBlock*> it) {
- delete it.second;
- });
+ // std::for_each(functions.begin(), functions.end(),
+ // [](std::pair<uint64_t,LLVMFunction*> it) {
+ // delete it.second;
+ // });
+ // std::for_each(blocks.begin(), blocks.end(),
+ // [](std::pair<uint64_t, LLVMBasicBlock*> it) {
+ // delete it.second;
+ // });
}
template <typename ELFT>