Win64EHDumper.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //===- Win64EHDumper.h - Win64 EH Printing ----------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
  9. #define LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
  10. #include "llvm/Support/ScopedPrinter.h"
  11. #include "llvm/Support/Win64EH.h"
  12. namespace llvm {
  13. namespace object {
  14. class COFFObjectFile;
  15. class SymbolRef;
  16. struct coff_section;
  17. }
  18. namespace Win64EH {
  19. class Dumper {
  20. ScopedPrinter &SW;
  21. raw_ostream &OS;
  22. public:
  23. typedef std::error_code (*SymbolResolver)(const object::coff_section *,
  24. uint64_t, object::SymbolRef &,
  25. void *);
  26. struct Context {
  27. const object::COFFObjectFile &COFF;
  28. SymbolResolver ResolveSymbol;
  29. void *UserData;
  30. Context(const object::COFFObjectFile &COFF, SymbolResolver Resolver,
  31. void *UserData)
  32. : COFF(COFF), ResolveSymbol(Resolver), UserData(UserData) {}
  33. };
  34. private:
  35. void printRuntimeFunctionEntry(const Context &Ctx,
  36. const object::coff_section *Section,
  37. uint64_t SectionOffset,
  38. const RuntimeFunction &RF);
  39. void printUnwindCode(const UnwindInfo& UI, ArrayRef<UnwindCode> UC);
  40. void printUnwindInfo(const Context &Ctx, const object::coff_section *Section,
  41. off_t Offset, const UnwindInfo &UI);
  42. void printRuntimeFunction(const Context &Ctx,
  43. const object::coff_section *Section,
  44. uint64_t SectionOffset, const RuntimeFunction &RF);
  45. public:
  46. Dumper(ScopedPrinter &SW) : SW(SW), OS(SW.getOStream()) {}
  47. void printData(const Context &Ctx);
  48. };
  49. }
  50. }
  51. #endif