annotate tools/llvm-pdbutil/PrettyExternalSymbolDumper.cpp @ 133:c60214abe0e8

fix intrin.h
author mir3636
date Fri, 16 Feb 2018 19:10:49 +0900
parents 803732b1fca8
children c2174574ed3a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
121
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
1 //===- PrettyExternalSymbolDumper.cpp -------------------------- *- C++ *-===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
2 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
3 // The LLVM Compiler Infrastructure
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
4 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
5 // This file is distributed under the University of Illinois Open Source
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
6 // License. See LICENSE.TXT for details.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
7 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
8 //===----------------------------------------------------------------------===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
9
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
10 #include "PrettyExternalSymbolDumper.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
11 #include "LinePrinter.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
12
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
13 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
14 #include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
15 #include "llvm/Support/Format.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
16
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
17 using namespace llvm;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
18 using namespace llvm::pdb;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
19
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
20 ExternalSymbolDumper::ExternalSymbolDumper(LinePrinter &P)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
21 : PDBSymDumper(true), Printer(P) {}
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
22
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
23 void ExternalSymbolDumper::start(const PDBSymbolExe &Symbol) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
24 auto Vars = Symbol.findAllChildren<PDBSymbolPublicSymbol>();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
25 while (auto Var = Vars->getNext())
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
26 Var->dump(*this);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
27 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
28
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
29 void ExternalSymbolDumper::dump(const PDBSymbolPublicSymbol &Symbol) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
30 std::string LinkageName = Symbol.getName();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
31 if (Printer.IsSymbolExcluded(LinkageName))
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
32 return;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
33
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
34 Printer.NewLine();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
35 uint64_t Addr = Symbol.getVirtualAddress();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
36
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
37 Printer << "[";
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
38 WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Addr, 10);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
39 Printer << "] ";
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
40 WithColor(Printer, PDB_ColorItem::Identifier).get() << LinkageName;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
41 }