summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/PDBSymbolThunk.cpp
blob: dc24507b1d1f7ed908973b292f37f491dbe7c319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//===- 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 <utility>

#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"

#include "llvm/Support/Format.h"

using namespace llvm;

PDBSymbolThunk::PDBSymbolThunk(const IPDBSession &PDBSession,
                               std::unique_ptr<IPDBRawSymbol> Symbol)
    : PDBSymbol(PDBSession, std::move(Symbol)) {}

void PDBSymbolThunk::dump(raw_ostream &OS, int Indent,
                          PDB_DumpLevel Level) const {
  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) << "]";
  }
  OS << " (" << Ordinal << ")";
  if (Ordinal == PDB_ThunkOrdinal::TrampIncremental)
    OS << " -> " << format_hex(getTargetRelativeVirtualAddress(), 10);
  OS << " ";
  std::string Name = getName();
  if (!Name.empty())
    OS << Name;
}
OpenPOWER on IntegriCloud