2014-05-26 04:26:45 +08:00
|
|
|
//===- Win64EHDumper.h - Win64 EH Printing ----------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08: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-26 04:26:45 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
|
|
|
|
#define LLVM_TOOLS_LLVM_READOBJ_WIN64EHDUMPER_H
|
2014-05-26 04:26:45 +08:00
|
|
|
|
2016-05-03 08:28:04 +08:00
|
|
|
#include "llvm/Support/ScopedPrinter.h"
|
2014-05-26 04:26:45 +08:00
|
|
|
#include "llvm/Support/Win64EH.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace object {
|
|
|
|
class COFFObjectFile;
|
|
|
|
class SymbolRef;
|
|
|
|
struct coff_section;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Win64EH {
|
|
|
|
class Dumper {
|
2016-05-03 08:28:04 +08:00
|
|
|
ScopedPrinter &SW;
|
2014-05-26 04:26:45 +08:00
|
|
|
raw_ostream &OS;
|
|
|
|
|
|
|
|
public:
|
2014-06-13 09:25:41 +08:00
|
|
|
typedef std::error_code (*SymbolResolver)(const object::coff_section *,
|
|
|
|
uint64_t, object::SymbolRef &,
|
|
|
|
void *);
|
2014-05-26 04:26:45 +08:00
|
|
|
|
|
|
|
struct Context {
|
|
|
|
const object::COFFObjectFile &COFF;
|
|
|
|
SymbolResolver ResolveSymbol;
|
2014-05-26 05:37:59 +08:00
|
|
|
void *UserData;
|
2014-05-26 04:26:45 +08:00
|
|
|
|
2014-05-26 05:37:59 +08:00
|
|
|
Context(const object::COFFObjectFile &COFF, SymbolResolver Resolver,
|
|
|
|
void *UserData)
|
|
|
|
: COFF(COFF), ResolveSymbol(Resolver), UserData(UserData) {}
|
2014-05-26 04:26:45 +08: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 08:28:04 +08:00
|
|
|
Dumper(ScopedPrinter &SW) : SW(SW), OS(SW.getOStream()) {}
|
2014-05-26 04:26:45 +08:00
|
|
|
|
|
|
|
void printData(const Context &Ctx);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|