#define INCLUDE__LLVMDisassembler_hxx
#include <memory>
+#include <map>
#include <log4cxx/logger.h>
#include "include_llvm.hxx"
#include "disassembler/Disassembler.hxx"
+#include "disassembler/BasicBlock.hxx"
+#include "disassembler/Function.hxx"
+#include "disassembler/llvm/LLVMBasicBlock.hxx"
+#include "disassembler/llvm/LLVMFunction.hxx"
class LLVMDisassembler
: public Disassembler {
public:
LLVMDisassembler(const std::string& filename);
- virtual ~LLVMDisassembler() {};
+ virtual ~LLVMDisassembler();
void getSymbols();
uint64_t entryAddress();
- void forEachInstruction(const std::string& name, std::function<void (long, std::string, std::string)> callback) {}
+ void forEachFunction(std::function<void (uint64_t, Function*)> callback);
BasicBlock * generateControlFlowGraph(const std::string& name);
BasicBlock * generateControlFlowGraph(uint64_t address);
bool isJump(uint64_t address) {return false;}
private:
+ void disassemble();
+
+ void readSymbols();
+ void readSections();
+
log4cxx::LoggerPtr logger;
+ std::map<uint64_t, LLVMBasicBlock*> blocks;
+ std::map<uint64_t, LLVMFunction*> functions;
llvm::Triple triple;
std::shared_ptr<llvm::object::Binary> binary;