mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 03:29:40 +00:00
Move the implementation of the Win64 EH printer from the COFFDumper into its own class. This is in preparation for adding support to print ARM EH information. The only real change here is in printUnwindInfo where we now lambda lift the implicit this parameter for the resolveFunction. Also setup the printing to handle ARM. This now has set the stage to introduce ARM EH printing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209606 91177308-0d34-0410-b5e6-96231b3b80d8
63 lines
1.8 KiB
C++
63 lines
1.8 KiB
C++
//===- Win64EHDumper.h - Win64 EH Printing ----------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TOOLS_READOBJ_WIN64EHPRINTER_H
|
|
#define LLVM_TOOLS_READOBJ_WIN64EHPRINTER_H
|
|
|
|
#include "StreamWriter.h"
|
|
#include "llvm/Support/Win64EH.h"
|
|
|
|
#include <functional>
|
|
|
|
namespace llvm {
|
|
namespace object {
|
|
class COFFObjectFile;
|
|
class SymbolRef;
|
|
struct coff_section;
|
|
}
|
|
|
|
namespace Win64EH {
|
|
class Dumper {
|
|
StreamWriter &SW;
|
|
raw_ostream &OS;
|
|
|
|
public:
|
|
typedef std::function<error_code(const object::coff_section *, uint64_t,
|
|
object::SymbolRef &)> SymbolResolver;
|
|
|
|
struct Context {
|
|
const object::COFFObjectFile &COFF;
|
|
SymbolResolver ResolveSymbol;
|
|
|
|
Context(const object::COFFObjectFile &COFF, SymbolResolver Resolver)
|
|
: COFF(COFF), ResolveSymbol(Resolver) {}
|
|
};
|
|
|
|
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:
|
|
Dumper(StreamWriter &SW) : SW(SW), OS(SW.getOStream()) {}
|
|
|
|
void printData(const Context &Ctx);
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif
|