2015-02-08 08:29:29 +08:00
|
|
|
//===- PDBSymbolThunk.cpp - -------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
|
2015-02-11 06:43:25 +08:00
|
|
|
#include "llvm/Support/Format.h"
|
2015-02-13 17:09:03 +08:00
|
|
|
#include <utility>
|
2015-02-11 06:43:25 +08:00
|
|
|
|
2015-02-08 08:29:29 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2015-02-09 06:53:53 +08:00
|
|
|
PDBSymbolThunk::PDBSymbolThunk(const IPDBSession &PDBSession,
|
2015-02-09 04:58:09 +08:00
|
|
|
std::unique_ptr<IPDBRawSymbol> Symbol)
|
2015-02-09 07:15:37 +08:00
|
|
|
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
2015-02-08 08:29:29 +08:00
|
|
|
|
2015-02-11 06:43:25 +08:00
|
|
|
void PDBSymbolThunk::dump(raw_ostream &OS, int Indent,
|
|
|
|
PDB_DumpLevel Level) const {
|
2015-02-13 15:40:03 +08:00
|
|
|
OS.indent(Indent);
|
|
|
|
OS << "thunk ";
|
|
|
|
PDB_ThunkOrdinal Ordinal = getThunkOrdinal();
|
|
|
|
uint32_t RVA = getRelativeVirtualAddress();
|
|
|
|
if (Ordinal == PDB_ThunkOrdinal::TrampIncremental) {
|
|
|
|
OS << format_hex(RVA, 10);
|
|
|
|
} else {
|
|
|
|
OS << "[" << format_hex(RVA, 10);
|
|
|
|
OS << " - " << format_hex(RVA + getLength(), 10) << "]";
|
2015-02-11 06:43:25 +08:00
|
|
|
}
|
2015-02-13 15:40:03 +08:00
|
|
|
OS << " (" << Ordinal << ")";
|
|
|
|
if (Ordinal == PDB_ThunkOrdinal::TrampIncremental)
|
|
|
|
OS << " -> " << format_hex(getTargetRelativeVirtualAddress(), 10);
|
|
|
|
OS << " ";
|
|
|
|
std::string Name = getName();
|
|
|
|
if (!Name.empty())
|
|
|
|
OS << Name;
|
2015-02-11 06:43:25 +08:00
|
|
|
}
|