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