Recursive disassembler
[frida/frida.git] / src / disassembler / llvm / LLVMDisassembler.hxx
index ff81be55385890a7ca642d9fa7d50a469ea001ac..4f58a0eb8450078758d5dd6486138cc8d500afda 100644 (file)
@@ -2,11 +2,13 @@
 #define INCLUDE__LLVMDisassembler_hxx
 
 #include <memory>
+#include <map>
 #include <log4cxx/logger.h>
 
 #include "include_llvm.hxx"
 
 #include "disassembler/Disassembler.hxx"
+#include "disassembler/llvm/LLVMBasicBlock.hxx"
 
 
 class LLVMDisassembler
@@ -18,7 +20,9 @@ public:
        void getSymbols();
        uint64_t entryAddress();
 
-    void forEachInstruction(const std::string& name, std::function<void (long, std::string, std::string)> callback) {}
+    void forEachInstruction(const std::string& name,
+                                                       std::function<void (long, std::string, std::string)> callback)
+               {}
 
        BasicBlock * generateControlFlowGraph(const std::string& name);
        BasicBlock * generateControlFlowGraph(uint64_t address);
@@ -28,7 +32,13 @@ protected:
     bool isJump(uint64_t address) {return false;}
 
 private:
+       void disassemble();
+
+       void readSymbols();
+       void readSections();
+
     log4cxx::LoggerPtr logger;
+       std::map<uint8_t, LLVMBasicBlock*> blocks;
 
     llvm::Triple triple;
     std::shared_ptr<llvm::object::Binary> binary;