1 //===- NativeExeSymbol.cpp - native impl for PDBSymbolExe -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/DebugInfo/PDB/Native/NativeExeSymbol.h"
12 #include "llvm/ADT/STLExtras.h"
13 #include "llvm/DebugInfo/PDB/Native/DbiStream.h"
14 #include "llvm/DebugInfo/PDB/Native/InfoStream.h"
15 #include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
16 #include "llvm/DebugInfo/PDB/Native/NativeEnumModules.h"
17 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
18 #include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
19 #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
22 using namespace llvm::pdb;
24 static DbiStream *getDbiStreamPtr(NativeSession &Session) {
25 Expected<DbiStream &> DbiS = Session.getPDBFile().getPDBDbiStream();
29 consumeError(DbiS.takeError());
33 NativeExeSymbol::NativeExeSymbol(NativeSession &Session, SymIndexId SymbolId)
34 : NativeRawSymbol(Session, PDB_SymType::Exe, SymbolId),
35 Dbi(getDbiStreamPtr(Session)) {}
37 std::unique_ptr<IPDBEnumSymbols>
38 NativeExeSymbol::findChildren(PDB_SymType Type) const {
40 case PDB_SymType::Compiland: {
41 return std::unique_ptr<IPDBEnumSymbols>(new NativeEnumModules(Session));
44 case PDB_SymType::Enum:
45 return Session.getSymbolCache().createTypeEnumerator(codeview::LF_ENUM);
46 case PDB_SymType::PointerType:
47 return Session.getSymbolCache().createTypeEnumerator(codeview::LF_POINTER);
54 uint32_t NativeExeSymbol::getAge() const {
55 auto IS = Session.getPDBFile().getPDBInfoStream();
58 consumeError(IS.takeError());
62 std::string NativeExeSymbol::getSymbolsFileName() const {
63 return Session.getPDBFile().getFilePath();
66 codeview::GUID NativeExeSymbol::getGuid() const {
67 auto IS = Session.getPDBFile().getPDBInfoStream();
70 consumeError(IS.takeError());
71 return codeview::GUID{{0}};
74 bool NativeExeSymbol::hasCTypes() const {
75 auto Dbi = Session.getPDBFile().getPDBDbiStream();
77 return Dbi->hasCTypes();
78 consumeError(Dbi.takeError());
82 bool NativeExeSymbol::hasPrivateSymbols() const {
83 auto Dbi = Session.getPDBFile().getPDBDbiStream();
85 return !Dbi->isStripped();
86 consumeError(Dbi.takeError());