2014-06-04 23:47:15 +08:00
|
|
|
//===--- ARMWinEHPrinter.h - Windows on ARM Unwind Information Printer ----===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_TOOLS_LLVM_READOBJ_ARMWINEHPRINTER_H
|
|
|
|
#define LLVM_TOOLS_LLVM_READOBJ_ARMWINEHPRINTER_H
|
2014-06-04 23:47:15 +08:00
|
|
|
|
|
|
|
#include "StreamWriter.h"
|
2014-06-05 00:03:18 +08:00
|
|
|
#include "llvm/Object/COFF.h"
|
2014-06-04 23:47:15 +08:00
|
|
|
#include "llvm/Support/ErrorOr.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace ARM {
|
|
|
|
namespace WinEH {
|
|
|
|
class RuntimeFunction;
|
|
|
|
|
|
|
|
class Decoder {
|
|
|
|
static const size_t PDataEntrySize;
|
|
|
|
|
|
|
|
StreamWriter &SW;
|
|
|
|
raw_ostream &OS;
|
|
|
|
|
|
|
|
struct RingEntry {
|
|
|
|
uint8_t Mask;
|
|
|
|
uint8_t Value;
|
2014-09-12 05:46:33 +08:00
|
|
|
bool (Decoder::*Routine)(const uint8_t *, unsigned &, unsigned, bool);
|
2014-06-04 23:47:15 +08:00
|
|
|
};
|
|
|
|
static const RingEntry Ring[];
|
|
|
|
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_0xxxxxxx(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_10Lxxxxx(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_1100xxxx(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11010Lxx(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11011Lxx(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11100xxx(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_111010xx(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_1110110L(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11101110(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11101111(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11110101(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11110110(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11110111(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11111000(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11111001(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11111010(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11111011(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11111100(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11111101(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11111110(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
2014-09-12 05:46:33 +08:00
|
|
|
bool opcode_11111111(const uint8_t *Opcodes, unsigned &Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
unsigned Length, bool Prologue);
|
|
|
|
|
2014-09-12 05:46:33 +08:00
|
|
|
void decodeOpcodes(ArrayRef<uint8_t> Opcodes, unsigned Offset,
|
2014-06-04 23:47:15 +08:00
|
|
|
bool Prologue);
|
|
|
|
|
|
|
|
void printRegisters(const std::pair<uint16_t, uint32_t> &RegisterMask);
|
|
|
|
|
|
|
|
ErrorOr<object::SectionRef>
|
|
|
|
getSectionContaining(const object::COFFObjectFile &COFF, uint64_t Address);
|
|
|
|
|
|
|
|
ErrorOr<object::SymbolRef>
|
|
|
|
getSymbol(const object::COFFObjectFile &COFF, uint64_t Address,
|
|
|
|
bool FunctionOnly = false);
|
|
|
|
|
|
|
|
ErrorOr<object::SymbolRef>
|
|
|
|
getRelocatedSymbol(const object::COFFObjectFile &COFF,
|
|
|
|
const object::SectionRef &Section, uint64_t Offset);
|
|
|
|
|
|
|
|
bool dumpXDataRecord(const object::COFFObjectFile &COFF,
|
|
|
|
const object::SectionRef &Section,
|
|
|
|
uint64_t FunctionAddress, uint64_t VA);
|
|
|
|
bool dumpUnpackedEntry(const object::COFFObjectFile &COFF,
|
|
|
|
const object::SectionRef Section, uint64_t Offset,
|
|
|
|
unsigned Index, const RuntimeFunction &Entry);
|
|
|
|
bool dumpPackedEntry(const object::COFFObjectFile &COFF,
|
|
|
|
const object::SectionRef Section, uint64_t Offset,
|
|
|
|
unsigned Index, const RuntimeFunction &Entry);
|
|
|
|
bool dumpProcedureDataEntry(const object::COFFObjectFile &COFF,
|
|
|
|
const object::SectionRef Section, unsigned Entry,
|
|
|
|
ArrayRef<uint8_t> Contents);
|
|
|
|
void dumpProcedureData(const object::COFFObjectFile &COFF,
|
|
|
|
const object::SectionRef Section);
|
|
|
|
|
|
|
|
public:
|
|
|
|
Decoder(StreamWriter &SW) : SW(SW), OS(SW.getOStream()) {}
|
2014-06-13 09:25:41 +08:00
|
|
|
std::error_code dumpProcedureData(const object::COFFObjectFile &COFF);
|
2014-06-04 23:47:15 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|