1 //===--- ARMWinEHPrinter.h - Windows on ARM Unwind Information Printer ----===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_TOOLS_LLVM_READOBJ_ARMWINEHPRINTER_H
11 #define LLVM_TOOLS_LLVM_READOBJ_ARMWINEHPRINTER_H
13 #include "StreamWriter.h"
14 #include "llvm/Object/COFF.h"
15 #include "llvm/Support/ErrorOr.h"
20 class RuntimeFunction;
23 static const size_t PDataEntrySize;
31 bool (Decoder::*Routine)(const support::ulittle8_t *, unsigned &, unsigned,
34 static const RingEntry Ring[];
36 bool opcode_0xxxxxxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
37 unsigned Length, bool Prologue);
38 bool opcode_10Lxxxxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
39 unsigned Length, bool Prologue);
40 bool opcode_1100xxxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
41 unsigned Length, bool Prologue);
42 bool opcode_11010Lxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
43 unsigned Length, bool Prologue);
44 bool opcode_11011Lxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
45 unsigned Length, bool Prologue);
46 bool opcode_11100xxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
47 unsigned Length, bool Prologue);
48 bool opcode_111010xx(const support::ulittle8_t *Opcodes, unsigned &Offset,
49 unsigned Length, bool Prologue);
50 bool opcode_1110110L(const support::ulittle8_t *Opcodes, unsigned &Offset,
51 unsigned Length, bool Prologue);
52 bool opcode_11101110(const support::ulittle8_t *Opcodes, unsigned &Offset,
53 unsigned Length, bool Prologue);
54 bool opcode_11101111(const support::ulittle8_t *Opcodes, unsigned &Offset,
55 unsigned Length, bool Prologue);
56 bool opcode_11110101(const support::ulittle8_t *Opcodes, unsigned &Offset,
57 unsigned Length, bool Prologue);
58 bool opcode_11110110(const support::ulittle8_t *Opcodes, unsigned &Offset,
59 unsigned Length, bool Prologue);
60 bool opcode_11110111(const support::ulittle8_t *Opcodes, unsigned &Offset,
61 unsigned Length, bool Prologue);
62 bool opcode_11111000(const support::ulittle8_t *Opcodes, unsigned &Offset,
63 unsigned Length, bool Prologue);
64 bool opcode_11111001(const support::ulittle8_t *Opcodes, unsigned &Offset,
65 unsigned Length, bool Prologue);
66 bool opcode_11111010(const support::ulittle8_t *Opcodes, unsigned &Offset,
67 unsigned Length, bool Prologue);
68 bool opcode_11111011(const support::ulittle8_t *Opcodes, unsigned &Offset,
69 unsigned Length, bool Prologue);
70 bool opcode_11111100(const support::ulittle8_t *Opcodes, unsigned &Offset,
71 unsigned Length, bool Prologue);
72 bool opcode_11111101(const support::ulittle8_t *Opcodes, unsigned &Offset,
73 unsigned Length, bool Prologue);
74 bool opcode_11111110(const support::ulittle8_t *Opcodes, unsigned &Offset,
75 unsigned Length, bool Prologue);
76 bool opcode_11111111(const support::ulittle8_t *Opcodes, unsigned &Offset,
77 unsigned Length, bool Prologue);
79 void decodeOpcodes(ArrayRef<support::ulittle8_t> Opcodes, unsigned Offset,
82 void printRegisters(const std::pair<uint16_t, uint32_t> &RegisterMask);
84 ErrorOr<object::SectionRef>
85 getSectionContaining(const object::COFFObjectFile &COFF, uint64_t Address);
87 ErrorOr<object::SymbolRef>
88 getSymbol(const object::COFFObjectFile &COFF, uint64_t Address,
89 bool FunctionOnly = false);
91 ErrorOr<object::SymbolRef>
92 getRelocatedSymbol(const object::COFFObjectFile &COFF,
93 const object::SectionRef &Section, uint64_t Offset);
95 bool dumpXDataRecord(const object::COFFObjectFile &COFF,
96 const object::SectionRef &Section,
97 uint64_t FunctionAddress, uint64_t VA);
98 bool dumpUnpackedEntry(const object::COFFObjectFile &COFF,
99 const object::SectionRef Section, uint64_t Offset,
100 unsigned Index, const RuntimeFunction &Entry);
101 bool dumpPackedEntry(const object::COFFObjectFile &COFF,
102 const object::SectionRef Section, uint64_t Offset,
103 unsigned Index, const RuntimeFunction &Entry);
104 bool dumpProcedureDataEntry(const object::COFFObjectFile &COFF,
105 const object::SectionRef Section, unsigned Entry,
106 ArrayRef<uint8_t> Contents);
107 void dumpProcedureData(const object::COFFObjectFile &COFF,
108 const object::SectionRef Section);
111 Decoder(StreamWriter &SW) : SW(SW), OS(SW.getOStream()) {}
112 std::error_code dumpProcedureData(const object::COFFObjectFile &COFF);