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 "llvm/Object/COFF.h"
14 #include "llvm/Support/ErrorOr.h"
15 #include "llvm/Support/ScopedPrinter.h"
20 class RuntimeFunction
;
23 static const size_t PDataEntrySize
;
31 bool (Decoder::*Routine
)(const uint8_t *, unsigned &, unsigned, bool);
33 static const RingEntry Ring
[];
35 bool opcode_0xxxxxxx(const uint8_t *Opcodes
, unsigned &Offset
,
36 unsigned Length
, bool Prologue
);
37 bool opcode_10Lxxxxx(const uint8_t *Opcodes
, unsigned &Offset
,
38 unsigned Length
, bool Prologue
);
39 bool opcode_1100xxxx(const uint8_t *Opcodes
, unsigned &Offset
,
40 unsigned Length
, bool Prologue
);
41 bool opcode_11010Lxx(const uint8_t *Opcodes
, unsigned &Offset
,
42 unsigned Length
, bool Prologue
);
43 bool opcode_11011Lxx(const uint8_t *Opcodes
, unsigned &Offset
,
44 unsigned Length
, bool Prologue
);
45 bool opcode_11100xxx(const uint8_t *Opcodes
, unsigned &Offset
,
46 unsigned Length
, bool Prologue
);
47 bool opcode_111010xx(const uint8_t *Opcodes
, unsigned &Offset
,
48 unsigned Length
, bool Prologue
);
49 bool opcode_1110110L(const uint8_t *Opcodes
, unsigned &Offset
,
50 unsigned Length
, bool Prologue
);
51 bool opcode_11101110(const uint8_t *Opcodes
, unsigned &Offset
,
52 unsigned Length
, bool Prologue
);
53 bool opcode_11101111(const uint8_t *Opcodes
, unsigned &Offset
,
54 unsigned Length
, bool Prologue
);
55 bool opcode_11110101(const uint8_t *Opcodes
, unsigned &Offset
,
56 unsigned Length
, bool Prologue
);
57 bool opcode_11110110(const uint8_t *Opcodes
, unsigned &Offset
,
58 unsigned Length
, bool Prologue
);
59 bool opcode_11110111(const uint8_t *Opcodes
, unsigned &Offset
,
60 unsigned Length
, bool Prologue
);
61 bool opcode_11111000(const uint8_t *Opcodes
, unsigned &Offset
,
62 unsigned Length
, bool Prologue
);
63 bool opcode_11111001(const uint8_t *Opcodes
, unsigned &Offset
,
64 unsigned Length
, bool Prologue
);
65 bool opcode_11111010(const uint8_t *Opcodes
, unsigned &Offset
,
66 unsigned Length
, bool Prologue
);
67 bool opcode_11111011(const uint8_t *Opcodes
, unsigned &Offset
,
68 unsigned Length
, bool Prologue
);
69 bool opcode_11111100(const uint8_t *Opcodes
, unsigned &Offset
,
70 unsigned Length
, bool Prologue
);
71 bool opcode_11111101(const uint8_t *Opcodes
, unsigned &Offset
,
72 unsigned Length
, bool Prologue
);
73 bool opcode_11111110(const uint8_t *Opcodes
, unsigned &Offset
,
74 unsigned Length
, bool Prologue
);
75 bool opcode_11111111(const uint8_t *Opcodes
, unsigned &Offset
,
76 unsigned Length
, bool Prologue
);
78 void decodeOpcodes(ArrayRef
<uint8_t> Opcodes
, unsigned Offset
,
81 void printRegisters(const std::pair
<uint16_t, uint32_t> &RegisterMask
);
83 ErrorOr
<object::SectionRef
>
84 getSectionContaining(const object::COFFObjectFile
&COFF
, uint64_t Address
);
86 ErrorOr
<object::SymbolRef
>
87 getSymbol(const object::COFFObjectFile
&COFF
, uint64_t Address
,
88 bool FunctionOnly
= false);
90 ErrorOr
<object::SymbolRef
>
91 getRelocatedSymbol(const object::COFFObjectFile
&COFF
,
92 const object::SectionRef
&Section
, uint64_t Offset
);
94 bool dumpXDataRecord(const object::COFFObjectFile
&COFF
,
95 const object::SectionRef
&Section
,
96 uint64_t FunctionAddress
, uint64_t VA
);
97 bool dumpUnpackedEntry(const object::COFFObjectFile
&COFF
,
98 const object::SectionRef Section
, uint64_t Offset
,
99 unsigned Index
, const RuntimeFunction
&Entry
);
100 bool dumpPackedEntry(const object::COFFObjectFile
&COFF
,
101 const object::SectionRef Section
, uint64_t Offset
,
102 unsigned Index
, const RuntimeFunction
&Entry
);
103 bool dumpProcedureDataEntry(const object::COFFObjectFile
&COFF
,
104 const object::SectionRef Section
, unsigned Entry
,
105 ArrayRef
<uint8_t> Contents
);
106 void dumpProcedureData(const object::COFFObjectFile
&COFF
,
107 const object::SectionRef Section
);
110 Decoder(ScopedPrinter
&SW
) : SW(SW
), OS(SW
.getOStream()) {}
111 std::error_code
dumpProcedureData(const object::COFFObjectFile
&COFF
);