]> git.siccegge.de Git - frida/frida.git/blob - src/Binary.hxx
Consistently use include-guards
[frida/frida.git] / src / Binary.hxx
1 #ifndef INCLUDE__Binary_hxx
2 #define INCLUDE__Binary_hxx
3
4 #include "include_llvm.hxx"
5 #include "Section.hxx"
6
7 #include <string>
8 #include <vector>
9 #include <functional>
10
11 using llvm::OwningPtr;
12
13 class Binary {
14 public:
15 Binary(const std::string& filename);
16
17 void disassemble();
18
19 void disassemble_functions();
20
21 void disassemble_cfg();
22
23 std::vector<std::string> getSymbols();
24
25 std::vector<std::string> getFunctions();
26 void for_each_instruction(const std::string& function, std::function<void (long, std::string, std::string)> callback);
27
28 private:
29 llvm::Triple triple;
30 const llvm::Target * target;
31 llvm::object::ObjectFile * o;
32
33 llvm::object::Binary* binary;
34 OwningPtr<const llvm::MCRegisterInfo> MRI;
35 OwningPtr<const llvm::MCAsmInfo> AsmInfo;
36 OwningPtr<llvm::MCModule> Mod;
37 OwningPtr<llvm::MCInstPrinter> IP;
38 OwningPtr<llvm::MCDisassembler> DisAsm;
39 OwningPtr<const llvm::MCObjectFileInfo> MOFI;
40 OwningPtr<llvm::MCContext> Ctx;
41 OwningPtr<const llvm::MCInstrAnalysis> MIA;
42 OwningPtr<const llvm::MCSubtargetInfo> STI;
43 OwningPtr<const llvm::MCInstrInfo> MII;
44 OwningPtr<llvm::MCRelocationInfo> RelInfo;
45 OwningPtr<llvm::MCSymbolizer> Symzer;
46
47 std::map<std::string, llvm::object::SectionRef> sections;
48 std::map<std::string, llvm::object::SymbolRef> symbols;
49 };
50 #endif