ARMWinEHPrinter.h 5.0 KB

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