LLVM  13.0.0git
NativeSession.cpp
Go to the documentation of this file.
1 //===- NativeSession.cpp - Native implementation of IPDBSession -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 
11 #include "llvm/ADT/STLExtras.h"
30 #include "llvm/Object/COFF.h"
31 #include "llvm/Support/Allocator.h"
33 #include "llvm/Support/Error.h"
34 #include "llvm/Support/ErrorOr.h"
37 #include "llvm/Support/Path.h"
38 
39 #include <algorithm>
40 #include <cassert>
41 #include <memory>
42 #include <utility>
43 
44 using namespace llvm;
45 using namespace llvm::msf;
46 using namespace llvm::pdb;
47 
49  Expected<DbiStream &> DbiS = File.getPDBDbiStream();
50  if (DbiS)
51  return &DbiS.get();
52 
53  consumeError(DbiS.takeError());
54  return nullptr;
55 }
56 
57 NativeSession::NativeSession(std::unique_ptr<PDBFile> PdbFile,
58  std::unique_ptr<BumpPtrAllocator> Allocator)
59  : Pdb(std::move(PdbFile)), Allocator(std::move(Allocator)),
60  Cache(*this, getDbiStreamPtr(*Pdb)), AddrToModuleIndex(IMapAllocator) {}
61 
63 
64 Error NativeSession::createFromPdb(std::unique_ptr<MemoryBuffer> Buffer,
65  std::unique_ptr<IPDBSession> &Session) {
66  StringRef Path = Buffer->getBufferIdentifier();
67  auto Stream = std::make_unique<MemoryBufferByteStream>(
69 
70  auto Allocator = std::make_unique<BumpPtrAllocator>();
71  auto File = std::make_unique<PDBFile>(Path, std::move(Stream), *Allocator);
72  if (auto EC = File->parseFileHeaders())
73  return EC;
74  if (auto EC = File->parseStreamData())
75  return EC;
76 
77  Session =
78  std::make_unique<NativeSession>(std::move(File), std::move(Allocator));
79 
80  return Error::success();
81 }
82 
84 loadPdbFile(StringRef PdbPath, std::unique_ptr<BumpPtrAllocator> &Allocator) {
86  MemoryBuffer::getFile(PdbPath, /*IsText=*/false,
87  /*RequiresNullTerminator=*/false);
88  if (!ErrorOrBuffer)
89  return make_error<RawError>(ErrorOrBuffer.getError());
90  std::unique_ptr<llvm::MemoryBuffer> Buffer = std::move(*ErrorOrBuffer);
91 
92  PdbPath = Buffer->getBufferIdentifier();
94  auto EC = identify_magic(PdbPath, Magic);
95  if (EC || Magic != file_magic::pdb)
96  return make_error<RawError>(EC);
97 
98  auto Stream = std::make_unique<MemoryBufferByteStream>(std::move(Buffer),
100 
101  auto File = std::make_unique<PDBFile>(PdbPath, std::move(Stream), *Allocator);
102  if (auto EC = File->parseFileHeaders())
103  return std::move(EC);
104 
105  if (auto EC = File->parseStreamData())
106  return std::move(EC);
107 
108  return std::move(File);
109 }
110 
112  std::unique_ptr<IPDBSession> &Session) {
113  auto Allocator = std::make_unique<BumpPtrAllocator>();
114  auto PdbFile = loadPdbFile(PdbPath, Allocator);
115  if (!PdbFile)
116  return PdbFile.takeError();
117 
118  Session = std::make_unique<NativeSession>(std::move(PdbFile.get()),
119  std::move(Allocator));
120  return Error::success();
121 }
122 
125  object::createBinary(ExePath);
126  if (!BinaryFile)
127  return BinaryFile.takeError();
128 
129  const object::COFFObjectFile *ObjFile =
130  dyn_cast<object::COFFObjectFile>(BinaryFile->getBinary());
131  if (!ObjFile)
132  return make_error<RawError>(raw_error_code::invalid_format);
133 
134  StringRef PdbPath;
135  const llvm::codeview::DebugInfo *PdbInfo = nullptr;
136  if (Error E = ObjFile->getDebugPDBInfo(PdbInfo, PdbPath))
137  return std::move(E);
138 
139  return std::string(PdbPath);
140 }
141 
143  std::unique_ptr<IPDBSession> &Session) {
144  Expected<std::string> PdbPath = getPdbPathFromExe(ExePath);
145  if (!PdbPath)
146  return PdbPath.takeError();
147 
149  auto EC = identify_magic(PdbPath.get(), Magic);
150  if (EC || Magic != file_magic::pdb)
151  return make_error<RawError>(EC);
152 
153  auto Allocator = std::make_unique<BumpPtrAllocator>();
154  auto File = loadPdbFile(PdbPath.get(), Allocator);
155  if (!File)
156  return File.takeError();
157 
158  Session = std::make_unique<NativeSession>(std::move(File.get()),
159  std::move(Allocator));
160 
161  return Error::success();
162 }
163 
165 NativeSession::searchForPdb(const PdbSearchOptions &Opts) {
166  Expected<std::string> PathOrErr = getPdbPathFromExe(Opts.ExePath);
167  if (!PathOrErr)
168  return PathOrErr.takeError();
169  StringRef PathFromExe = PathOrErr.get();
170  sys::path::Style Style = PathFromExe.startswith("/")
173  StringRef PdbName = sys::path::filename(PathFromExe, Style);
174 
175  // Check if pdb exists in the executable directory.
176  SmallString<128> PdbPath = StringRef(Opts.ExePath);
178  sys::path::append(PdbPath, PdbName);
179 
180  auto Allocator = std::make_unique<BumpPtrAllocator>();
181 
182  if (auto File = loadPdbFile(PdbPath, Allocator))
183  return std::string(PdbPath);
184  else
185  consumeError(File.takeError());
186 
187  // Check path that was in the executable.
188  if (auto File = loadPdbFile(PathFromExe, Allocator))
189  return std::string(PathFromExe);
190  else
191  return File.takeError();
192 
193  return make_error<RawError>("PDB not found");
194 }
195 
196 uint64_t NativeSession::getLoadAddress() const { return LoadAddress; }
197 
198 bool NativeSession::setLoadAddress(uint64_t Address) {
199  LoadAddress = Address;
200  return true;
201 }
202 
203 std::unique_ptr<PDBSymbolExe> NativeSession::getGlobalScope() {
204  return PDBSymbol::createAs<PDBSymbolExe>(*this, getNativeGlobalScope());
205 }
206 
207 std::unique_ptr<PDBSymbol>
209  return Cache.getSymbolById(SymbolId);
210 }
211 
213  uint32_t &Offset) const {
214  uint32_t RVA = VA - getLoadAddress();
215  return addressForRVA(RVA, Section, Offset);
216 }
217 
219  uint32_t &Offset) const {
220  Section = 0;
221  Offset = 0;
222 
223  auto Dbi = Pdb->getPDBDbiStream();
224  if (!Dbi)
225  return false;
226 
227  if ((int32_t)RVA < 0)
228  return true;
229 
230  Offset = RVA;
231  for (; Section < Dbi->getSectionHeaders().size(); ++Section) {
232  auto &Sec = Dbi->getSectionHeaders()[Section];
233  if (RVA < Sec.VirtualAddress)
234  return true;
235  Offset = RVA - Sec.VirtualAddress;
236  }
237  return true;
238 }
239 
240 std::unique_ptr<PDBSymbol>
246 }
247 
248 std::unique_ptr<PDBSymbol> NativeSession::findSymbolByRVA(uint32_t RVA,
249  PDB_SymType Type) {
254 }
255 
256 std::unique_ptr<PDBSymbol>
258  PDB_SymType Type) {
259  if (AddrToModuleIndex.empty())
260  parseSectionContribs();
261 
262  return Cache.findSymbolBySectOffset(Sect, Offset, Type);
263 }
264 
265 std::unique_ptr<IPDBEnumLineNumbers>
267  const IPDBSourceFile &File) const {
268  return nullptr;
269 }
270 
271 std::unique_ptr<IPDBEnumLineNumbers>
273  uint32_t Length) const {
274  return Cache.findLineNumbersByVA(Address, Length);
275 }
276 
277 std::unique_ptr<IPDBEnumLineNumbers>
279  return Cache.findLineNumbersByVA(getLoadAddress() + RVA, Length);
280 }
281 
282 std::unique_ptr<IPDBEnumLineNumbers>
284  uint32_t Length) const {
285  uint64_t VA = getVAFromSectOffset(Section, Offset);
286  return Cache.findLineNumbersByVA(VA, Length);
287 }
288 
289 std::unique_ptr<IPDBEnumSourceFiles>
292  PDB_NameSearchFlags Flags) const {
293  return nullptr;
294 }
295 
296 std::unique_ptr<IPDBSourceFile>
299  PDB_NameSearchFlags Flags) const {
300  return nullptr;
301 }
302 
303 std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
305  PDB_NameSearchFlags Flags) const {
306  return nullptr;
307 }
308 
309 std::unique_ptr<PDBSymbolCompiland>
311  PDB_NameSearchFlags Flags) const {
312  return nullptr;
313 }
314 
315 std::unique_ptr<IPDBEnumSourceFiles> NativeSession::getAllSourceFiles() const {
316  return nullptr;
317 }
318 
319 std::unique_ptr<IPDBEnumSourceFiles> NativeSession::getSourceFilesForCompiland(
320  const PDBSymbolCompiland &Compiland) const {
321  return nullptr;
322 }
323 
324 std::unique_ptr<IPDBSourceFile>
326  return Cache.getSourceFileById(FileId);
327 }
328 
329 std::unique_ptr<IPDBEnumDataStreams> NativeSession::getDebugStreams() const {
330  return nullptr;
331 }
332 
333 std::unique_ptr<IPDBEnumTables> NativeSession::getEnumTables() const {
334  return nullptr;
335 }
336 
337 std::unique_ptr<IPDBEnumInjectedSources>
339  auto ISS = Pdb->getInjectedSourceStream();
340  if (!ISS) {
341  consumeError(ISS.takeError());
342  return nullptr;
343  }
344  auto Strings = Pdb->getStringTable();
345  if (!Strings) {
346  consumeError(Strings.takeError());
347  return nullptr;
348  }
349  return std::make_unique<NativeEnumInjectedSources>(*Pdb, *ISS, *Strings);
350 }
351 
352 std::unique_ptr<IPDBEnumSectionContribs>
354  return nullptr;
355 }
356 
357 std::unique_ptr<IPDBEnumFrameData>
359  return nullptr;
360 }
361 
362 void NativeSession::initializeExeSymbol() {
363  if (ExeSymbol == 0)
364  ExeSymbol = Cache.createSymbol<NativeExeSymbol>();
365 }
366 
368  const_cast<NativeSession &>(*this).initializeExeSymbol();
369 
370  return Cache.getNativeSymbolById<NativeExeSymbol>(ExeSymbol);
371 }
372 
374  uint32_t Offset) const {
375  if (Section <= 0)
376  return 0;
377 
378  auto Dbi = getDbiStreamPtr(*Pdb);
379  if (!Dbi)
380  return 0;
381 
382  uint32_t MaxSection = Dbi->getSectionHeaders().size();
383  if (Section > MaxSection + 1)
384  Section = MaxSection + 1;
385  auto &Sec = Dbi->getSectionHeaders()[Section - 1];
386  return Sec.VirtualAddress + Offset;
387 }
388 
390  uint32_t Offset) const {
391  return LoadAddress + getRVAFromSectOffset(Section, Offset);
392 }
393 
394 bool NativeSession::moduleIndexForVA(uint64_t VA, uint16_t &ModuleIndex) const {
395  ModuleIndex = 0;
396  auto Iter = AddrToModuleIndex.find(VA);
397  if (Iter == AddrToModuleIndex.end())
398  return false;
399  ModuleIndex = Iter.value();
400  return true;
401 }
402 
404  uint16_t &ModuleIndex) const {
405  ModuleIndex = 0;
406  auto Iter = AddrToModuleIndex.find(getVAFromSectOffset(Sect, Offset));
407  if (Iter == AddrToModuleIndex.end())
408  return false;
409  ModuleIndex = Iter.value();
410  return true;
411 }
412 
413 void NativeSession::parseSectionContribs() {
414  auto Dbi = Pdb->getPDBDbiStream();
415  if (!Dbi)
416  return;
417 
418  class Visitor : public ISectionContribVisitor {
419  NativeSession &Session;
420  IMap &AddrMap;
421 
422  public:
423  Visitor(NativeSession &Session, IMap &AddrMap)
424  : Session(Session), AddrMap(AddrMap) {}
425  void visit(const SectionContrib &C) override {
426  if (C.Size == 0)
427  return;
428 
429  uint64_t VA = Session.getVAFromSectOffset(C.ISect, C.Off);
430  uint64_t End = VA + C.Size;
431 
432  // Ignore overlapping sections based on the assumption that a valid
433  // PDB file should not have overlaps.
434  if (!AddrMap.overlaps(VA, End))
435  AddrMap.insert(VA, End, C.Imod);
436  }
437  void visit(const SectionContrib2 &C) override { visit(C.Base); }
438  };
439 
440  Visitor V(*this, AddrToModuleIndex);
441  Dbi->visitSectionContributions(V);
442 }
443 
446  auto *Dbi = getDbiStreamPtr(*Pdb);
447  assert(Dbi && "Dbi stream not present");
448 
449  DbiModuleDescriptor Modi = Dbi->modules().getModuleDescriptor(Index);
450 
451  uint16_t ModiStream = Modi.getModuleStreamIndex();
452  if (ModiStream == kInvalidStreamIndex)
453  return make_error<RawError>("Module stream not present");
454 
455  std::unique_ptr<msf::MappedBlockStream> ModStreamData =
456  Pdb->createIndexedStream(ModiStream);
457 
458  ModuleDebugStreamRef ModS(Modi, std::move(ModStreamData));
459  if (auto EC = ModS.reload())
460  return std::move(EC);
461 
462  return std::move(ModS);
463 }
MemoryBuffer.h
llvm::StringRef::startswith
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:286
llvm
Definition: AllocatorList.h:23
llvm::pdb::NativeSession::getRVAFromSectOffset
uint32_t getRVAFromSectOffset(uint32_t Section, uint32_t Offset) const
Definition: NativeSession.cpp:373
llvm::pdb::NativeSession::getEnumTables
std::unique_ptr< IPDBEnumTables > getEnumTables() const override
Definition: NativeSession.cpp:333
FileSystem.h
llvm::file_magic
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...
Definition: Magic.h:20
llvm::pdb::SectionContrib
Definition: RawTypes.h:46
TpiStream.h
llvm::pdb::ModuleDebugStreamRef
Definition: ModuleDebugStream.h:28
llvm::sys::path::Style::posix
@ posix
BinaryByteStream.h
llvm::pdb::SymbolCache::getSourceFileById
std::unique_ptr< IPDBSourceFile > getSourceFileById(SymIndexId FileId) const
Definition: SymbolCache.cpp:609
llvm::pdb::ISectionContribVisitor
Definition: ISectionContribVisitor.h:18
llvm::file_magic::pdb
@ pdb
Windows PDB debug info file.
Definition: Magic.h:51
NativeCompilandSymbol.h
Path.h
llvm::pdb::IPDBSourceFile
IPDBSourceFile defines an interface used to represent source files whose information are stored in th...
Definition: IPDBSourceFile.h:23
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:332
llvm::pdb::NativeSession::getSourceFilesForCompiland
std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const override
Definition: NativeSession.cpp:319
Allocator.h
llvm::pdb::kInvalidStreamIndex
const uint16_t kInvalidStreamIndex
Definition: RawConstants.h:19
Error.h
llvm::pdb::NativeSession::getVAFromSectOffset
uint64_t getVAFromSectOffset(uint32_t Section, uint32_t Offset) const
Definition: NativeSession.cpp:389
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:46
llvm::pdb::NativeSession::findOneSourceFile
std::unique_ptr< IPDBSourceFile > findOneSourceFile(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: NativeSession.cpp:297
getDbiStreamPtr
static DbiStream * getDbiStreamPtr(PDBFile &File)
Definition: NativeSession.cpp:48
llvm::pdb::NativeSession::createFromExe
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: NativeSession.cpp:142
llvm::pdb::raw_error_code::invalid_format
@ invalid_format
NativeEnumInjectedSources.h
llvm::IntervalMap::empty
bool empty() const
empty - Return true when no intervals are mapped.
Definition: IntervalMap.h:1055
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
STLExtras.h
llvm::pdb::SymbolCache::createSymbol
SymIndexId createSymbol(Args &&...ConstructorArgs) const
Definition: SymbolCache.h:121
llvm::pdb::NativeSession::getFrameData
std::unique_ptr< IPDBEnumFrameData > getFrameData() const override
Definition: NativeSession.cpp:358
llvm::pdb::DbiStream
Definition: DbiStream.h:37
RawError.h
llvm::pdb::NativeSession::getModuleDebugStream
Expected< ModuleDebugStreamRef > getModuleDebugStream(uint32_t Index) const
Definition: NativeSession.cpp:445
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1006
llvm::msf
Definition: IMSFFile.h:18
llvm::pdb::PDB_SymType
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn....
Definition: PDBTypes.h:243
llvm::pdb::NativeSession::findLineNumbersBySectOffset
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, uint32_t Length) const override
Definition: NativeSession.cpp:283
llvm::pdb::NativeSession::getLoadAddress
uint64_t getLoadAddress() const override
Definition: NativeSession.cpp:196
llvm::sys::path::append
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
Definition: Path.cpp:454
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
llvm::pdb::NativeSession::getInjectedSources
std::unique_ptr< IPDBEnumInjectedSources > getInjectedSources() const override
Definition: NativeSession.cpp:338
llvm::pdb::NativeExeSymbol
Definition: NativeExeSymbol.h:20
llvm::pdb::NativeSession::moduleIndexForVA
bool moduleIndexForVA(uint64_t VA, uint16_t &ModuleIndex) const
Definition: NativeSession.cpp:394
llvm::MemoryBuffer::getFile
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
Definition: MemoryBuffer.cpp:246
llvm::pdb::NativeSession::findLineNumbersByAddress
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override
Definition: NativeSession.cpp:272
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::support::little
@ little
Definition: Endian.h:27
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
PDBSymbolTypeEnum.h
llvm::pdb::NativeSession::createFromPdbPath
static Error createFromPdbPath(StringRef PdbPath, std::unique_ptr< IPDBSession > &Session)
Definition: NativeSession.cpp:111
llvm::pdb::NativeSession::getSourceFileById
std::unique_ptr< IPDBSourceFile > getSourceFileById(uint32_t FileId) const override
Definition: NativeSession.cpp:325
llvm::ErrorOr::getError
std::error_code getError() const
Definition: ErrorOr.h:153
llvm::pdb::PDB_NameSearchFlags
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:102
llvm::sys::path::Style
Style
Definition: Path.h:28
llvm::pdb::NativeSession::findSourceFiles
std::unique_ptr< IPDBEnumSourceFiles > findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: NativeSession.cpp:290
llvm::sys::path::Style::windows
@ windows
llvm::SmallString< 128 >
llvm::pdb
Definition: ConcreteSymbolEnumerator.h:20
llvm::pdb::SymbolCache::getSymbolById
std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const
Definition: SymbolCache.cpp:242
llvm::pdb::SectionContrib2
Definition: RawTypes.h:59
llvm::pdb::ModuleDebugStreamRef::reload
Error reload()
Definition: ModuleDebugStream.cpp:37
llvm::pdb::SymbolCache::findSymbolBySectOffset
std::unique_ptr< PDBSymbol > findSymbolBySectOffset(uint32_t Sect, uint32_t Offset, PDB_SymType Type)
Definition: SymbolCache.cpp:309
llvm::pdb::NativeSession::getSectionContribs
std::unique_ptr< IPDBEnumSectionContribs > getSectionContribs() const override
Definition: NativeSession.cpp:353
llvm::pdb::NativeSession::createFromPdb
static Error createFromPdb(std::unique_ptr< MemoryBuffer > MB, std::unique_ptr< IPDBSession > &Session)
Definition: NativeSession.cpp:64
llvm::pdb::NativeSession::setLoadAddress
bool setLoadAddress(uint64_t Address) override
Definition: NativeSession.cpp:198
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::pdb::NativeSession::findLineNumbersByRVA
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const override
Definition: NativeSession.cpp:278
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
ErrorOr.h
llvm::pdb::NativeSession::findSymbolByRVA
std::unique_ptr< PDBSymbol > findSymbolByRVA(uint32_t RVA, PDB_SymType Type) override
Definition: NativeSession.cpp:248
PDBSymbolCompiland.h
llvm::pdb::NativeSession::addressForVA
bool addressForVA(uint64_t VA, uint32_t &Section, uint32_t &Offset) const override
Definition: NativeSession.cpp:212
Magic
const char Magic[]
Definition: Archive.cpp:41
llvm::HexStyle::Style
Style
Definition: MCInstPrinter.h:32
llvm::HighlightColor::Address
@ Address
IPDBEnumChildren.h
llvm::pdb::NativeSession::addressForRVA
bool addressForRVA(uint32_t RVA, uint32_t &Section, uint32_t &Offset) const override
Definition: NativeSession.cpp:218
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1540
llvm::IntervalMap::find
const_iterator find(KeyT x) const
find - Return an iterator pointing to the first interval ending at or after x, or end().
Definition: IntervalMap.h:1126
llvm::pdb::NativeSession::getGlobalScope
std::unique_ptr< PDBSymbolExe > getGlobalScope() override
Definition: NativeSession.cpp:203
getPdbPathFromExe
static Expected< std::string > getPdbPathFromExe(StringRef ExePath)
Definition: NativeSession.cpp:123
llvm::pdb::NativeSession::findSymbolBySectOffset
std::unique_ptr< PDBSymbol > findSymbolBySectOffset(uint32_t Sect, uint32_t Offset, PDB_SymType Type) override
Definition: NativeSession.cpp:257
NativeEnumTypes.h
DbiStream.h
llvm::size
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition: STLExtras.h:1463
llvm::pdb::NativeSession::getSymbolById
std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const override
Definition: NativeSession.cpp:208
llvm::IntervalMap::end
const_iterator end() const
Definition: IntervalMap.h:1112
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::object::COFFObjectFile::getDebugPDBInfo
Error getDebugPDBInfo(const debug_directory *DebugDir, const codeview::DebugInfo *&Info, StringRef &PDBFileName) const
Get PDB information out of a codeview debug directory entry.
PDBSymbolExe.h
llvm::Expected::get
reference get()
Returns a reference to the stored T value.
Definition: Error.h:537
uint32_t
IPDBSourceFile.h
ISectionContribVisitor.h
llvm::codeview::DebugInfo
Definition: CVDebugRecord.h:45
llvm::pdb::NativeSession::findSymbolByAddress
std::unique_ptr< PDBSymbol > findSymbolByAddress(uint64_t Address, PDB_SymType Type) override
Definition: NativeSession.cpp:241
llvm::pdb::NativeSession::~NativeSession
~NativeSession() override
std
Definition: BitVector.h:838
loadPdbFile
static Expected< std::unique_ptr< PDBFile > > loadPdbFile(StringRef PdbPath, std::unique_ptr< BumpPtrAllocator > &Allocator)
Definition: NativeSession.cpp:84
uint16_t
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::pdb::DbiModuleDescriptor::getModuleStreamIndex
uint16_t getModuleStreamIndex() const
Definition: DbiModuleDescriptor.cpp:48
llvm::object::COFFObjectFile
Definition: COFF.h:799
TypeIndex.h
llvm::pdb::NativeSession
Definition: NativeSession.h:28
NativeTypeEnum.h
llvm::pdb::NativeSession::searchForPdb
static Expected< std::string > searchForPdb(const PdbSearchOptions &Opts)
Definition: NativeSession.cpp:165
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition: Error.h:557
llvm::Pattern
Definition: FileCheckImpl.h:614
llvm::sys::path::filename
StringRef filename(StringRef path, Style style=Style::native)
Get filename.
Definition: Path.cpp:575
NativeTypeBuiltin.h
COFF.h
llvm::pdb::PDBFile
Definition: PDBFile.h:42
PDBFile.h
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:146
llvm::ErrorOr
Represents either an error or a value T.
Definition: ErrorOr.h:56
SymbolCache.h
llvm::pdb::NativeSession::findCompilandsForSourceFile
std::unique_ptr< IPDBEnumChildren< PDBSymbolCompiland > > findCompilandsForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: NativeSession.cpp:304
llvm::object::createBinary
Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr, bool InitContent=true)
Create a Binary from Source, autodetecting the file type.
Definition: Binary.cpp:46
llvm::sys::path::remove_filename
void remove_filename(SmallVectorImpl< char > &path, Style style=Style::native)
Remove the last component from path unless it is the root dir.
Definition: Path.cpp:472
llvm::pdb::NativeSession::findLineNumbers
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const override
Definition: NativeSession.cpp:266
llvm::pdb::SymbolCache::getNativeSymbolById
NativeRawSymbol & getNativeSymbolById(SymIndexId SymbolId) const
Definition: SymbolCache.cpp:258
llvm::pdb::PDBSymbolCompiland
Definition: PDBSymbolCompiland.h:21
llvm::pdb::DbiModuleDescriptor
Definition: DbiModuleDescriptor.h:23
llvm::identify_magic
file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
Definition: Magic.cpp:35
llvm::pdb::NativeSession::getNativeGlobalScope
NativeExeSymbol & getNativeGlobalScope() const
Definition: NativeSession.cpp:367
llvm::pdb::NativeSession::getAllSourceFiles
std::unique_ptr< IPDBEnumSourceFiles > getAllSourceFiles() const override
Definition: NativeSession.cpp:315
llvm::pdb::NativeSession::getDebugStreams
std::unique_ptr< IPDBEnumDataStreams > getDebugStreams() const override
Definition: NativeSession.cpp:329
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:206
NativeExeSymbol.h
llvm::pdb::NativeSession::findOneCompilandForSourceFile
std::unique_ptr< PDBSymbolCompiland > findOneCompilandForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: NativeSession.cpp:310
llvm::pdb::SymbolCache::findLineNumbersByVA
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByVA(uint64_t VA, uint32_t Length) const
Definition: SymbolCache.cpp:528
llvm::pdb::NativeSession::moduleIndexForSectOffset
bool moduleIndexForSectOffset(uint32_t Sect, uint32_t Offset, uint16_t &ModuleIndex) const
Definition: NativeSession.cpp:403
NativeSession.h