1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/tools/llvm-pdbdump/ExternalSymbolDumper.cpp
Zachary Turner 49ec888ed3 [llvm-pdbdump] Support dynamic load address and external symbols.
This patch adds the --load-address command line option to
llvm-pdbdump, which dumps all addresses assuming the module has
loaded at the specified address.

Additionally, this patch adds an option to llvm-pdbdump to support
dumping of public symbols (i.e. symbols with external linkage).

llvm-svn: 236342
2015-05-01 20:24:26 +00:00

41 lines
1.2 KiB
C++

//===- ExternalSymbolDumper.cpp -------------------------------- *- C++ *-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "ExternalSymbolDumper.h"
#include "LinePrinter.h"
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
#include "llvm/Support/Format.h"
using namespace llvm;
ExternalSymbolDumper::ExternalSymbolDumper(LinePrinter &P)
: PDBSymDumper(true), Printer(P) {}
void ExternalSymbolDumper::start(const PDBSymbolExe &Symbol) {
auto Vars = Symbol.findAllChildren<PDBSymbolPublicSymbol>();
while (auto Var = Vars->getNext())
Var->dump(*this);
}
void ExternalSymbolDumper::dump(const PDBSymbolPublicSymbol &Symbol) {
std::string LinkageName = Symbol.getName();
if (Printer.IsSymbolExcluded(LinkageName))
return;
Printer.NewLine();
uint64_t Addr = Symbol.getVirtualAddress();
Printer << "[";
WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Addr, 10);
Printer << "] ";
WithColor(Printer, PDB_ColorItem::Identifier).get() << LinkageName;
}