2014-05-25 22:26:45 +02:00
|
|
|
//===- Win64EHDumper.h - Win64 EH Printing ----------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-05-25 22:26:45 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#ifndef LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
|
|
|
|
#define LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
|
2014-05-25 22:26:45 +02:00
|
|
|
|
2016-05-03 02:28:04 +02:00
|
|
|
#include "llvm/Support/ScopedPrinter.h"
|
2014-05-25 22:26:45 +02:00
|
|
|
#include "llvm/Support/Win64EH.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace object {
|
|
|
|
class COFFObjectFile;
|
|
|
|
class SymbolRef;
|
|
|
|
struct coff_section;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Win64EH {
|
|
|
|
class Dumper {
|
2016-05-03 02:28:04 +02:00
|
|
|
ScopedPrinter &SW;
|
2014-05-25 22:26:45 +02:00
|
|
|
raw_ostream &OS;
|
|
|
|
|
|
|
|
public:
|
2014-06-13 03:25:41 +02:00
|
|
|
typedef std::error_code (*SymbolResolver)(const object::coff_section *,
|
|
|
|
uint64_t, object::SymbolRef &,
|
|
|
|
void *);
|
2014-05-25 22:26:45 +02:00
|
|
|
|
|
|
|
struct Context {
|
|
|
|
const object::COFFObjectFile &COFF;
|
|
|
|
SymbolResolver ResolveSymbol;
|
2014-05-25 23:37:59 +02:00
|
|
|
void *UserData;
|
2014-05-25 22:26:45 +02:00
|
|
|
|
2014-05-25 23:37:59 +02:00
|
|
|
Context(const object::COFFObjectFile &COFF, SymbolResolver Resolver,
|
|
|
|
void *UserData)
|
|
|
|
: COFF(COFF), ResolveSymbol(Resolver), UserData(UserData) {}
|
2014-05-25 22:26:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
void printRuntimeFunctionEntry(const Context &Ctx,
|
|
|
|
const object::coff_section *Section,
|
|
|
|
uint64_t SectionOffset,
|
|
|
|
const RuntimeFunction &RF);
|
|
|
|
void printUnwindCode(const UnwindInfo& UI, ArrayRef<UnwindCode> UC);
|
|
|
|
void printUnwindInfo(const Context &Ctx, const object::coff_section *Section,
|
|
|
|
off_t Offset, const UnwindInfo &UI);
|
|
|
|
void printRuntimeFunction(const Context &Ctx,
|
|
|
|
const object::coff_section *Section,
|
|
|
|
uint64_t SectionOffset, const RuntimeFunction &RF);
|
|
|
|
|
|
|
|
public:
|
2016-05-03 02:28:04 +02:00
|
|
|
Dumper(ScopedPrinter &SW) : SW(SW), OS(SW.getOStream()) {}
|
2014-05-25 22:26:45 +02:00
|
|
|
|
|
|
|
void printData(const Context &Ctx);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|