ExternalSymbolDumper.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #include "ExternalSymbolDumper.h"
  10. #include "LinePrinter.h"
  11. #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
  12. #include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
  13. #include "llvm/Support/Format.h"
  14. using namespace llvm;
  15. ExternalSymbolDumper::ExternalSymbolDumper(LinePrinter &P)
  16. : PDBSymDumper(true), Printer(P) {}
  17. void ExternalSymbolDumper::start(const PDBSymbolExe &Symbol) {
  18. auto Vars = Symbol.findAllChildren<PDBSymbolPublicSymbol>();
  19. while (auto Var = Vars->getNext())
  20. Var->dump(*this);
  21. }
  22. void ExternalSymbolDumper::dump(const PDBSymbolPublicSymbol &Symbol) {
  23. std::string LinkageName = Symbol.getName();
  24. if (Printer.IsSymbolExcluded(LinkageName))
  25. return;
  26. Printer.NewLine();
  27. uint64_t Addr = Symbol.getVirtualAddress();
  28. Printer << "[";
  29. WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Addr, 10);
  30. Printer << "] ";
  31. WithColor(Printer, PDB_ColorItem::Identifier).get() << LinkageName;
  32. }