Home | History | Annotate | Download | only in llvm-pdbdump
      1 //===- ExternalSymbolDumper.cpp -------------------------------- *- C++ *-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #include "ExternalSymbolDumper.h"
     11 #include "LinePrinter.h"
     12 
     13 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
     14 #include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
     15 #include "llvm/Support/Format.h"
     16 
     17 using namespace llvm;
     18 
     19 ExternalSymbolDumper::ExternalSymbolDumper(LinePrinter &P)
     20     : PDBSymDumper(true), Printer(P) {}
     21 
     22 void ExternalSymbolDumper::start(const PDBSymbolExe &Symbol) {
     23   auto Vars = Symbol.findAllChildren<PDBSymbolPublicSymbol>();
     24   while (auto Var = Vars->getNext())
     25     Var->dump(*this);
     26 }
     27 
     28 void ExternalSymbolDumper::dump(const PDBSymbolPublicSymbol &Symbol) {
     29   std::string LinkageName = Symbol.getName();
     30   if (Printer.IsSymbolExcluded(LinkageName))
     31     return;
     32 
     33   Printer.NewLine();
     34   uint64_t Addr = Symbol.getVirtualAddress();
     35 
     36   Printer << "[";
     37   WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Addr, 10);
     38   Printer << "] ";
     39   WithColor(Printer, PDB_ColorItem::Identifier).get() << LinkageName;
     40 }
     41