2017-01-11 01:35:43 +01:00
|
|
|
//===- PrettyExternalSymbolDumper.cpp -------------------------- *- C++ *-===//
|
2015-05-01 22:24:26 +02:00
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-05-01 22:24:26 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-01-11 01:35:43 +01:00
|
|
|
#include "PrettyExternalSymbolDumper.h"
|
2015-05-01 22:24:26 +02:00
|
|
|
#include "LinePrinter.h"
|
|
|
|
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
|
|
|
|
#include "llvm/Support/Format.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
2016-05-04 22:32:13 +02:00
|
|
|
using namespace llvm::pdb;
|
2015-05-01 22:24:26 +02:00
|
|
|
|
|
|
|
ExternalSymbolDumper::ExternalSymbolDumper(LinePrinter &P)
|
|
|
|
: PDBSymDumper(true), Printer(P) {}
|
|
|
|
|
|
|
|
void ExternalSymbolDumper::start(const PDBSymbolExe &Symbol) {
|
2018-03-07 03:23:08 +01:00
|
|
|
if (auto Vars = Symbol.findAllChildren<PDBSymbolPublicSymbol>()) {
|
|
|
|
while (auto Var = Vars->getNext())
|
|
|
|
Var->dump(*this);
|
|
|
|
}
|
2015-05-01 22:24:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ExternalSymbolDumper::dump(const PDBSymbolPublicSymbol &Symbol) {
|
|
|
|
std::string LinkageName = Symbol.getName();
|
|
|
|
if (Printer.IsSymbolExcluded(LinkageName))
|
|
|
|
return;
|
|
|
|
|
|
|
|
Printer.NewLine();
|
|
|
|
uint64_t Addr = Symbol.getVirtualAddress();
|
|
|
|
|
2018-07-06 23:01:42 +02:00
|
|
|
Printer << "public [";
|
2015-05-01 22:24:26 +02:00
|
|
|
WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Addr, 10);
|
|
|
|
Printer << "] ";
|
|
|
|
WithColor(Printer, PDB_ColorItem::Identifier).get() << LinkageName;
|
|
|
|
}
|