Win64EHDumper.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //===- Win64EHDumper.h - Win64 EH Printing ----------------------*- C++ -*-===//
  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_WIN64EHDUMPER_H
  10. #define LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
  11. #include "StreamWriter.h"
  12. #include "llvm/Support/Win64EH.h"
  13. namespace llvm {
  14. namespace object {
  15. class COFFObjectFile;
  16. class SymbolRef;
  17. struct coff_section;
  18. }
  19. namespace Win64EH {
  20. class Dumper {
  21. StreamWriter &SW;
  22. raw_ostream &OS;
  23. public:
  24. typedef std::error_code (*SymbolResolver)(const object::coff_section *,
  25. uint64_t, object::SymbolRef &,
  26. void *);
  27. struct Context {
  28. const object::COFFObjectFile &COFF;
  29. SymbolResolver ResolveSymbol;
  30. void *UserData;
  31. Context(const object::COFFObjectFile &COFF, SymbolResolver Resolver,
  32. void *UserData)
  33. : COFF(COFF), ResolveSymbol(Resolver), UserData(UserData) {}
  34. };
  35. private:
  36. void printRuntimeFunctionEntry(const Context &Ctx,
  37. const object::coff_section *Section,
  38. uint64_t SectionOffset,
  39. const RuntimeFunction &RF);
  40. void printUnwindCode(const UnwindInfo& UI, ArrayRef<UnwindCode> UC);
  41. void printUnwindInfo(const Context &Ctx, const object::coff_section *Section,
  42. off_t Offset, const UnwindInfo &UI);
  43. void printRuntimeFunction(const Context &Ctx,
  44. const object::coff_section *Section,
  45. uint64_t SectionOffset, const RuntimeFunction &RF);
  46. public:
  47. Dumper(StreamWriter &SW) : SW(SW), OS(SW.getOStream()) {}
  48. void printData(const Context &Ctx);
  49. };
  50. }
  51. }
  52. #endif