Home | History | Annotate | Download | only in llvm-readobj
      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 
     10 #ifndef LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
     11 #define LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
     12 
     13 #include "llvm/Support/ScopedPrinter.h"
     14 #include "llvm/Support/Win64EH.h"
     15 
     16 namespace llvm {
     17 namespace object {
     18 class COFFObjectFile;
     19 class SymbolRef;
     20 struct coff_section;
     21 }
     22 
     23 namespace Win64EH {
     24 class Dumper {
     25   ScopedPrinter &SW;
     26   raw_ostream &OS;
     27 
     28 public:
     29   typedef std::error_code (*SymbolResolver)(const object::coff_section *,
     30                                             uint64_t, object::SymbolRef &,
     31                                             void *);
     32 
     33   struct Context {
     34     const object::COFFObjectFile &COFF;
     35     SymbolResolver ResolveSymbol;
     36     void *UserData;
     37 
     38     Context(const object::COFFObjectFile &COFF, SymbolResolver Resolver,
     39             void *UserData)
     40       : COFF(COFF), ResolveSymbol(Resolver), UserData(UserData) {}
     41   };
     42 
     43 private:
     44   void printRuntimeFunctionEntry(const Context &Ctx,
     45                                  const object::coff_section *Section,
     46                                  uint64_t SectionOffset,
     47                                  const RuntimeFunction &RF);
     48   void printUnwindCode(const UnwindInfo& UI, ArrayRef<UnwindCode> UC);
     49   void printUnwindInfo(const Context &Ctx, const object::coff_section *Section,
     50                        off_t Offset, const UnwindInfo &UI);
     51   void printRuntimeFunction(const Context &Ctx,
     52                             const object::coff_section *Section,
     53                             uint64_t SectionOffset, const RuntimeFunction &RF);
     54 
     55 public:
     56   Dumper(ScopedPrinter &SW) : SW(SW), OS(SW.getOStream()) {}
     57 
     58   void printData(const Context &Ctx);
     59 };
     60 }
     61 }
     62 
     63 #endif
     64