1 #ifndef INCLUDE__LLVMDisassembler_hxx
2 #define INCLUDE__LLVMDisassembler_hxx
5 #include <log4cxx/logger.h>
7 #include "include_llvm.hxx"
9 #include "disassembler/Disassembler.hxx"
12 class LLVMDisassembler
13 : public Disassembler {
15 LLVMDisassembler(const std::string& filename);
16 virtual ~LLVMDisassembler() {};
19 uint64_t entryAddress();
21 void forEachInstruction(const std::string& name, std::function<void (long, std::string, std::string)> callback) {}
23 BasicBlock * generateControlFlowGraph(const std::string& name);
24 BasicBlock * generateControlFlowGraph(uint64_t address);
27 bool isFunctionCall(uint64_t address) {return false;}
28 bool isJump(uint64_t address) {return false;}
31 log4cxx::LoggerPtr logger;
34 std::shared_ptr<llvm::object::Binary> binary;
37 const llvm::Target * target;
38 llvm::object::ObjectFile * o;
40 std::unique_ptr<const llvm::MCRegisterInfo> MRI;
41 std::unique_ptr<const llvm::MCAsmInfo> AsmInfo;
42 std::unique_ptr<llvm::MCModule> Mod;
43 std::unique_ptr<llvm::MCInstPrinter> IP;
44 std::unique_ptr<llvm::MCDisassembler> DisAsm;
45 std::unique_ptr<const llvm::MCObjectFileInfo> MOFI;
46 std::unique_ptr<llvm::MCContext> Ctx;
47 std::unique_ptr<const llvm::MCInstrAnalysis> MIA;
48 std::unique_ptr<const llvm::MCSubtargetInfo> STI;
49 std::unique_ptr<const llvm::MCInstrInfo> MII;
50 llvm::OwningPtr<llvm::MCRelocationInfo> RelInfo;
51 llvm::OwningPtr<llvm::MCSymbolizer> Symzer;
53 std::map<std::string, llvm::object::SectionRef> sections;
54 std::map<std::string, llvm::object::SymbolRef> symbols;