annotate lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp @ 134:3a76565eade5 LLVM5.0.1

update 5.0.1
author mir3636
date Sat, 17 Feb 2018 09:57:20 +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 //===- NativeExeSymbol.cpp - native impl for PDBSymbolExe -------*- 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 "llvm/DebugInfo/PDB/Native/NativeExeSymbol.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
11
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
12 #include "llvm/ADT/STLExtras.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
13 #include "llvm/DebugInfo/PDB/Native/DbiStream.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
14 #include "llvm/DebugInfo/PDB/Native/InfoStream.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
15 #include "llvm/DebugInfo/PDB/Native/NativeEnumModules.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
16 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
17
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
18 namespace llvm {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
19 namespace pdb {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
20
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
21 NativeExeSymbol::NativeExeSymbol(NativeSession &Session, SymIndexId SymbolId)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
22 : NativeRawSymbol(Session, SymbolId), File(Session.getPDBFile()) {}
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
23
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
24 std::unique_ptr<NativeRawSymbol> NativeExeSymbol::clone() const {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
25 return llvm::make_unique<NativeExeSymbol>(Session, SymbolId);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
26 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
27
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
28 std::unique_ptr<IPDBEnumSymbols>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
29 NativeExeSymbol::findChildren(PDB_SymType Type) const {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
30 switch (Type) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
31 case PDB_SymType::Compiland: {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
32 auto Dbi = File.getPDBDbiStream();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
33 if (Dbi) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
34 const DbiModuleList &Modules = Dbi->modules();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
35 return std::unique_ptr<IPDBEnumSymbols>(
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
36 new NativeEnumModules(Session, Modules));
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
37 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
38 consumeError(Dbi.takeError());
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
39 break;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
40 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
41 case PDB_SymType::Enum:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
42 return Session.createTypeEnumerator(codeview::LF_ENUM);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
43 default:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
44 break;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
45 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
46 return nullptr;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
47 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
48
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
49 uint32_t NativeExeSymbol::getAge() const {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
50 auto IS = File.getPDBInfoStream();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
51 if (IS)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
52 return IS->getAge();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
53 consumeError(IS.takeError());
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
54 return 0;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
55 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
56
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
57 std::string NativeExeSymbol::getSymbolsFileName() const {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
58 return File.getFilePath();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
59 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
60
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
61 codeview::GUID NativeExeSymbol::getGuid() const {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
62 auto IS = File.getPDBInfoStream();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
63 if (IS)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
64 return IS->getGuid();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
65 consumeError(IS.takeError());
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
66 return codeview::GUID{{0}};
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
67 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
68
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
69 bool NativeExeSymbol::hasCTypes() const {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
70 auto Dbi = File.getPDBDbiStream();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
71 if (Dbi)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
72 return Dbi->hasCTypes();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
73 consumeError(Dbi.takeError());
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
74 return false;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
75 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
76
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
77 bool NativeExeSymbol::hasPrivateSymbols() const {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
78 auto Dbi = File.getPDBDbiStream();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
79 if (Dbi)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
80 return !Dbi->isStripped();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
81 consumeError(Dbi.takeError());
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
82 return false;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
83 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
84
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
85 } // namespace pdb
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
86 } // namespace llvm