1 //===- PDBSymbolFunc.cpp - --------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
13 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
14 #include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
15 #include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
16 #include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
18 #include "llvm/Support/Format.h"
21 PDBSymbolFunc::PDBSymbolFunc(const IPDBSession &PDBSession,
22 std::unique_ptr<IPDBRawSymbol> Symbol)
23 : PDBSymbol(PDBSession, std::move(Symbol)) {}
25 void PDBSymbolFunc::dump(raw_ostream &OS, int Indent,
26 PDB_DumpLevel Level) const {
27 if (Level == PDB_DumpLevel::Compact) {
28 uint32_t FuncStart = getRelativeVirtualAddress();
29 uint32_t FuncEnd = FuncStart + getLength();
30 OS << stream_indent(Indent);
31 OS << "[" << format_hex(FuncStart, 8);
32 if (auto DebugStart = findOneChild<PDBSymbolFuncDebugStart>())
33 OS << "+" << DebugStart->getRelativeVirtualAddress() - FuncStart;
34 OS << " - " << format_hex(FuncEnd, 8);
35 if (auto DebugEnd = findOneChild<PDBSymbolFuncDebugEnd>())
36 OS << "-" << FuncEnd - DebugEnd->getRelativeVirtualAddress();
38 PDB_RegisterId Reg = getLocalBasePointerRegisterId();
39 if (Reg == PDB_RegisterId::VFrame)
41 else if (hasFramePointer())
42 OS << "(" << Reg << ")";
45 OS << " " << getName() << "\n";