llvm-project
42 строки · 1.4 Кб
1//===- PrettyExternalSymbolDumper.cpp -------------------------- *- C++ *-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "PrettyExternalSymbolDumper.h"10
11#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"12#include "llvm/DebugInfo/PDB/Native/LinePrinter.h"13#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"14#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"15#include "llvm/Support/Format.h"16
17using namespace llvm;18using namespace llvm::pdb;19
20ExternalSymbolDumper::ExternalSymbolDumper(LinePrinter &P)21: PDBSymDumper(true), Printer(P) {}22
23void ExternalSymbolDumper::start(const PDBSymbolExe &Symbol) {24if (auto Vars = Symbol.findAllChildren<PDBSymbolPublicSymbol>()) {25while (auto Var = Vars->getNext())26Var->dump(*this);27}28}
29
30void ExternalSymbolDumper::dump(const PDBSymbolPublicSymbol &Symbol) {31std::string LinkageName = Symbol.getName();32if (Printer.IsSymbolExcluded(LinkageName))33return;34
35Printer.NewLine();36uint64_t Addr = Symbol.getVirtualAddress();37
38Printer << "public [";39WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Addr, 10);40Printer << "] ";41WithColor(Printer, PDB_ColorItem::Identifier).get() << LinkageName;42}
43