LLVM  16.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 
31 #include "llvm/Object/Binary.h"
32 #include "llvm/Object/COFF.h"
33 #include "llvm/Support/Allocator.h"
36 #include "llvm/Support/Error.h"
37 #include "llvm/Support/ErrorOr.h"
39 #include "llvm/Support/Path.h"
40 
41 #include <algorithm>
42 #include <cassert>
43 #include <memory>
44 #include <utility>
45 
46 using namespace llvm;
47 using namespace llvm::msf;
48 using namespace llvm::pdb;
49 
50 namespace llvm {
51 namespace codeview {
52 union DebugInfo;
53 }
54 } // namespace llvm
55 
57  Expected<DbiStream &> DbiS = File.getPDBDbiStream();
58  if (DbiS)
59  return &DbiS.get();
60 
61  consumeError(DbiS.takeError());
62  return nullptr;
63 }
64 
65 NativeSession::NativeSession(std::unique_ptr<PDBFile> PdbFile,
66  std::unique_ptr<BumpPtrAllocator> Allocator)
67  : Pdb(std::move(PdbFile)), Allocator(std::move(Allocator)),
68  Cache(*this, getDbiStreamPtr(*Pdb)), AddrToModuleIndex(IMapAllocator) {}
69 
71 
72 Error NativeSession::createFromPdb(std::unique_ptr<MemoryBuffer> Buffer,
73  std::unique_ptr<IPDBSession> &Session) {
74  StringRef Path = Buffer->getBufferIdentifier();
75  auto Stream = std::make_unique<MemoryBufferByteStream>(
77 
78  auto Allocator = std::make_unique<BumpPtrAllocator>();
79  auto File = std::make_unique<PDBFile>(Path, std::move(Stream), *Allocator);
80  if (auto EC = File->parseFileHeaders())
81  return EC;
82  if (auto EC = File->parseStreamData())
83  return EC;
84 
85  Session =
86  std::make_unique<NativeSession>(std::move(File), std::move(Allocator));
87 
88  return Error::success();
89 }
90 
92 loadPdbFile(StringRef PdbPath, std::unique_ptr<BumpPtrAllocator> &Allocator) {
94  MemoryBuffer::getFile(PdbPath, /*IsText=*/false,
95  /*RequiresNullTerminator=*/false);
96  if (!ErrorOrBuffer)
97  return make_error<RawError>(ErrorOrBuffer.getError());
98  std::unique_ptr<llvm::MemoryBuffer> Buffer = std::move(*ErrorOrBuffer);
99 
100  PdbPath = Buffer->getBufferIdentifier();
102  auto EC = identify_magic(PdbPath, Magic);
103  if (EC || Magic != file_magic::pdb)
104  return make_error<RawError>(EC);
105 
106  auto Stream = std::make_unique<MemoryBufferByteStream>(std::move(Buffer),
108 
109  auto File = std::make_unique<PDBFile>(PdbPath, std::move(Stream), *Allocator);
110  if (auto EC = File->parseFileHeaders())
111  return std::move(EC);
112 
113  if (auto EC = File->parseStreamData())
114  return std::move(EC);
115 
116  return std::move(File);
117 }
118 
120  std::unique_ptr<IPDBSession> &Session) {
121  auto Allocator = std::make_unique<BumpPtrAllocator>();
122  auto PdbFile = loadPdbFile(PdbPath, Allocator);
123  if (!PdbFile)
124  return PdbFile.takeError();
125 
126  Session = std::make_unique<NativeSession>(std::move(PdbFile.get()),
128  return Error::success();
129 }
130 
133  object::createBinary(ExePath);
134  if (!BinaryFile)
135  return BinaryFile.takeError();
136 
137  const object::COFFObjectFile *ObjFile =
138  dyn_cast<object::COFFObjectFile>(BinaryFile->getBinary());
139  if (!ObjFile)
140  return make_error<RawError>(raw_error_code::invalid_format);
141 
142  StringRef PdbPath;
143  const llvm::codeview::DebugInfo *PdbInfo = nullptr;
144  if (Error E = ObjFile->getDebugPDBInfo(PdbInfo, PdbPath))
145  return std::move(E);
146 
147  return std::string(PdbPath);
148 }
149 
151  std::unique_ptr<IPDBSession> &Session) {
152  Expected<std::string> PdbPath = getPdbPathFromExe(ExePath);
153  if (!PdbPath)
154  return PdbPath.takeError();
155 
157  auto EC = identify_magic(PdbPath.get(), Magic);
158  if (EC || Magic != file_magic::pdb)
159  return make_error<RawError>(EC);
160 
161  auto Allocator = std::make_unique<BumpPtrAllocator>();
162  auto File = loadPdbFile(PdbPath.get(), Allocator);
163  if (!File)
164  return File.takeError();
165 
166  Session = std::make_unique<NativeSession>(std::move(File.get()),
168 
169  return Error::success();
170 }
171 
173 NativeSession::searchForPdb(const PdbSearchOptions &Opts) {
174  Expected<std::string> PathOrErr = getPdbPathFromExe(Opts.ExePath);
175  if (!PathOrErr)
176  return PathOrErr.takeError();
177  StringRef PathFromExe = PathOrErr.get();
178  sys::path::Style Style = PathFromExe.startswith("/")
181  StringRef PdbName = sys::path::filename(PathFromExe, Style);
182 
183  // Check if pdb exists in the executable directory.
184  SmallString<128> PdbPath = StringRef(Opts.ExePath);
186  sys::path::append(PdbPath, PdbName);
187 
188  auto Allocator = std::make_unique<BumpPtrAllocator>();
189 
190  if (auto File = loadPdbFile(PdbPath, Allocator))
191  return std::string(PdbPath);
192  else
193  consumeError(File.takeError());
194 
195  // Check path that was in the executable.
196  if (auto File = loadPdbFile(PathFromExe, Allocator))
197  return std::string(PathFromExe);
198  else
199  return File.takeError();
200 
201  return make_error<RawError>("PDB not found");
202 }
203 
204 uint64_t NativeSession::getLoadAddress() const { return LoadAddress; }
205 
207  LoadAddress = Address;
208  return true;
209 }
210 
211 std::unique_ptr<PDBSymbolExe> NativeSession::getGlobalScope() {
212  return PDBSymbol::createAs<PDBSymbolExe>(*this, getNativeGlobalScope());
213 }
214 
215 std::unique_ptr<PDBSymbol>
217  return Cache.getSymbolById(SymbolId);
218 }
219 
221  uint32_t &Offset) const {
222  uint32_t RVA = VA - getLoadAddress();
223  return addressForRVA(RVA, Section, Offset);
224 }
225 
227  uint32_t &Offset) const {
228  Section = 0;
229  Offset = 0;
230 
231  auto Dbi = Pdb->getPDBDbiStream();
232  if (!Dbi)
233  return false;
234 
235  if ((int32_t)RVA < 0)
236  return true;
237 
238  Offset = RVA;
239  for (; Section < Dbi->getSectionHeaders().size(); ++Section) {
240  auto &Sec = Dbi->getSectionHeaders()[Section];
241  if (RVA < Sec.VirtualAddress)
242  return true;
243  Offset = RVA - Sec.VirtualAddress;
244  }
245  return true;
246 }
247 
248 std::unique_ptr<PDBSymbol>
254 }
255 
256 std::unique_ptr<PDBSymbol> NativeSession::findSymbolByRVA(uint32_t RVA,
257  PDB_SymType Type) {
262 }
263 
264 std::unique_ptr<PDBSymbol>
266  PDB_SymType Type) {
267  if (AddrToModuleIndex.empty())
268  parseSectionContribs();
269 
270  return Cache.findSymbolBySectOffset(Sect, Offset, Type);
271 }
272 
273 std::unique_ptr<IPDBEnumLineNumbers>
275  const IPDBSourceFile &File) const {
276  return nullptr;
277 }
278 
279 std::unique_ptr<IPDBEnumLineNumbers>
281  uint32_t Length) const {
282  return Cache.findLineNumbersByVA(Address, Length);
283 }
284 
285 std::unique_ptr<IPDBEnumLineNumbers>
287  return Cache.findLineNumbersByVA(getLoadAddress() + RVA, Length);
288 }
289 
290 std::unique_ptr<IPDBEnumLineNumbers>
292  uint32_t Length) const {
294  return Cache.findLineNumbersByVA(VA, Length);
295 }
296 
297 std::unique_ptr<IPDBEnumSourceFiles>
300  PDB_NameSearchFlags Flags) const {
301  return nullptr;
302 }
303 
304 std::unique_ptr<IPDBSourceFile>
307  PDB_NameSearchFlags Flags) const {
308  return nullptr;
309 }
310 
311 std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
313  PDB_NameSearchFlags Flags) const {
314  return nullptr;
315 }
316 
317 std::unique_ptr<PDBSymbolCompiland>
319  PDB_NameSearchFlags Flags) const {
320  return nullptr;
321 }
322 
323 std::unique_ptr<IPDBEnumSourceFiles> NativeSession::getAllSourceFiles() const {
324  return nullptr;
325 }
326 
327 std::unique_ptr<IPDBEnumSourceFiles> NativeSession::getSourceFilesForCompiland(
328  const PDBSymbolCompiland &Compiland) const {
329  return nullptr;
330 }
331 
332 std::unique_ptr<IPDBSourceFile>
334  return Cache.getSourceFileById(FileId);
335 }
336 
337 std::unique_ptr<IPDBEnumDataStreams> NativeSession::getDebugStreams() const {
338  return nullptr;
339 }
340 
341 std::unique_ptr<IPDBEnumTables> NativeSession::getEnumTables() const {
342  return nullptr;
343 }
344 
345 std::unique_ptr<IPDBEnumInjectedSources>
347  auto ISS = Pdb->getInjectedSourceStream();
348  if (!ISS) {
349  consumeError(ISS.takeError());
350  return nullptr;
351  }
352  auto Strings = Pdb->getStringTable();
353  if (!Strings) {
354  consumeError(Strings.takeError());
355  return nullptr;
356  }
357  return std::make_unique<NativeEnumInjectedSources>(*Pdb, *ISS, *Strings);
358 }
359 
360 std::unique_ptr<IPDBEnumSectionContribs>
362  return nullptr;
363 }
364 
365 std::unique_ptr<IPDBEnumFrameData>
367  return nullptr;
368 }
369 
370 void NativeSession::initializeExeSymbol() {
371  if (ExeSymbol == 0)
372  ExeSymbol = Cache.createSymbol<NativeExeSymbol>();
373 }
374 
376  const_cast<NativeSession &>(*this).initializeExeSymbol();
377 
378  return Cache.getNativeSymbolById<NativeExeSymbol>(ExeSymbol);
379 }
380 
382  uint32_t Offset) const {
383  if (Section <= 0)
384  return 0;
385 
386  auto Dbi = getDbiStreamPtr(*Pdb);
387  if (!Dbi)
388  return 0;
389 
390  uint32_t MaxSection = Dbi->getSectionHeaders().size();
391  if (Section > MaxSection + 1)
392  Section = MaxSection + 1;
393  auto &Sec = Dbi->getSectionHeaders()[Section - 1];
394  return Sec.VirtualAddress + Offset;
395 }
396 
398  uint32_t Offset) const {
399  return LoadAddress + getRVAFromSectOffset(Section, Offset);
400 }
401 
402 bool NativeSession::moduleIndexForVA(uint64_t VA, uint16_t &ModuleIndex) const {
403  ModuleIndex = 0;
404  auto Iter = AddrToModuleIndex.find(VA);
405  if (Iter == AddrToModuleIndex.end())
406  return false;
407  ModuleIndex = Iter.value();
408  return true;
409 }
410 
412  uint16_t &ModuleIndex) const {
413  ModuleIndex = 0;
414  auto Iter = AddrToModuleIndex.find(getVAFromSectOffset(Sect, Offset));
415  if (Iter == AddrToModuleIndex.end())
416  return false;
417  ModuleIndex = Iter.value();
418  return true;
419 }
420 
421 void NativeSession::parseSectionContribs() {
422  auto Dbi = Pdb->getPDBDbiStream();
423  if (!Dbi)
424  return;
425 
426  class Visitor : public ISectionContribVisitor {
427  NativeSession &Session;
428  IMap &AddrMap;
429 
430  public:
431  Visitor(NativeSession &Session, IMap &AddrMap)
432  : Session(Session), AddrMap(AddrMap) {}
433  void visit(const SectionContrib &C) override {
434  if (C.Size == 0)
435  return;
436 
437  uint64_t VA = Session.getVAFromSectOffset(C.ISect, C.Off);
438  uint64_t End = VA + C.Size;
439 
440  // Ignore overlapping sections based on the assumption that a valid
441  // PDB file should not have overlaps.
442  if (!AddrMap.overlaps(VA, End))
443  AddrMap.insert(VA, End, C.Imod);
444  }
445  void visit(const SectionContrib2 &C) override { visit(C.Base); }
446  };
447 
448  Visitor V(*this, AddrToModuleIndex);
449  Dbi->visitSectionContributions(V);
450 }
451 
454  auto *Dbi = getDbiStreamPtr(*Pdb);
455  assert(Dbi && "Dbi stream not present");
456 
457  DbiModuleDescriptor Modi = Dbi->modules().getModuleDescriptor(Index);
458 
459  uint16_t ModiStream = Modi.getModuleStreamIndex();
460  if (ModiStream == kInvalidStreamIndex)
461  return make_error<RawError>("Module stream not present");
462 
463  std::unique_ptr<msf::MappedBlockStream> ModStreamData =
464  Pdb->createIndexedStream(ModiStream);
465 
466  ModuleDebugStreamRef ModS(Modi, std::move(ModStreamData));
467  if (auto EC = ModS.reload())
468  return std::move(EC);
469 
470  return std::move(ModS);
471 }
MemoryBuffer.h
RawConstants.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::pdb::NativeSession::getRVAFromSectOffset
uint32_t getRVAFromSectOffset(uint32_t Section, uint32_t Offset) const
Definition: NativeSession.cpp:381
llvm::pdb::NativeSession::getEnumTables
std::unique_ptr< IPDBEnumTables > getEnumTables() const override
Definition: NativeSession.cpp:341
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
llvm::pdb::ModuleDebugStreamRef
Definition: ModuleDebugStream.h:31
llvm::sys::path::Style::posix
@ posix
RawTypes.h
BinaryByteStream.h
DbiModuleDescriptor.h
llvm::pdb::SymbolCache::getSourceFileById
std::unique_ptr< IPDBSourceFile > getSourceFileById(SymIndexId FileId) const
Definition: SymbolCache.cpp:614
llvm::pdb::ISectionContribVisitor
Definition: ISectionContribVisitor.h:18
llvm::file_magic::pdb
@ pdb
Windows PDB debug info file.
Definition: Magic.h:53
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:329
llvm::pdb::NativeSession::getSourceFilesForCompiland
std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const override
Definition: NativeSession.cpp:327
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:397
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::pdb::NativeSession::findOneSourceFile
std::unique_ptr< IPDBSourceFile > findOneSourceFile(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: NativeSession.cpp:305
getDbiStreamPtr
static DbiStream * getDbiStreamPtr(PDBFile &File)
Definition: NativeSession.cpp:56
llvm::pdb::NativeSession::createFromExe
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: NativeSession.cpp:150
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:1101
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:80
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::pdb::SymbolCache::createSymbol
SymIndexId createSymbol(Args &&...ConstructorArgs) const
Definition: SymbolCache.h:127
llvm::pdb::NativeSession::getFrameData
std::unique_ptr< IPDBEnumFrameData > getFrameData() const override
Definition: NativeSession.cpp:366
llvm::pdb::DbiStream
Definition: DbiStream.h:39
RawError.h
llvm::pdb::NativeSession::getModuleDebugStream
Expected< ModuleDebugStreamRef > getModuleDebugStream(uint32_t Index) const
Definition: NativeSession.cpp:453
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1042
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::MemoryBuffer::getFile
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false, Optional< Align > Alignment=None)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
Definition: MemoryBuffer.cpp:244
llvm::pdb::NativeSession::findLineNumbersBySectOffset
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, uint32_t Length) const override
Definition: NativeSession.cpp:291
llvm::pdb::NativeSession::getLoadAddress
uint64_t getLoadAddress() const override
Definition: NativeSession.cpp:204
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:456
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:82
llvm::pdb::NativeSession::getInjectedSources
std::unique_ptr< IPDBEnumInjectedSources > getInjectedSources() const override
Definition: NativeSession.cpp:346
llvm::pdb::NativeExeSymbol
Definition: NativeExeSymbol.h:23
llvm::pdb::NativeSession::moduleIndexForVA
bool moduleIndexForVA(uint64_t VA, uint16_t &ModuleIndex) const
Definition: NativeSession.cpp:402
llvm::pdb::NativeSession::findLineNumbersByAddress
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override
Definition: NativeSession.cpp:280
Magic.h
llvm::StringRef::startswith
bool startswith(StringRef Prefix) const
Definition: StringRef.h:260
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
llvm::pdb::NativeSession::createFromPdbPath
static Error createFromPdbPath(StringRef PdbPath, std::unique_ptr< IPDBSession > &Session)
Definition: NativeSession.cpp:119
llvm::pdb::NativeSession::getSourceFileById
std::unique_ptr< IPDBSourceFile > getSourceFileById(uint32_t FileId) const override
Definition: NativeSession.cpp:333
llvm::ErrorOr::getError
std::error_code getError() const
Definition: ErrorOr.h:153
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
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:27
llvm::pdb::PDB_ColorItem::Path
@ Path
PDBSymbol.h
llvm::pdb::NativeSession::findSourceFiles
std::unique_ptr< IPDBEnumSourceFiles > findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: NativeSession.cpp:298
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:247
llvm::pdb::SectionContrib2
Definition: RawTypes.h:59
llvm::pdb::ModuleDebugStreamRef::reload
Error reload()
Definition: ModuleDebugStream.cpp:38
llvm::pdb::SymbolCache::findSymbolBySectOffset
std::unique_ptr< PDBSymbol > findSymbolBySectOffset(uint32_t Sect, uint32_t Offset, PDB_SymType Type)
Definition: SymbolCache.cpp:314
llvm::pdb::NativeSession::getSectionContribs
std::unique_ptr< IPDBEnumSectionContribs > getSectionContribs() const override
Definition: NativeSession.cpp:361
llvm::pdb::PDB_ColorItem::Address
@ Address
llvm::pdb::NativeSession::createFromPdb
static Error createFromPdb(std::unique_ptr< MemoryBuffer > MB, std::unique_ptr< IPDBSession > &Session)
Definition: NativeSession.cpp:72
llvm::pdb::NativeSession::setLoadAddress
bool setLoadAddress(uint64_t Address) override
Definition: NativeSession.cpp:206
uint64_t
llvm::pdb::NativeSession::findLineNumbersByRVA
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const override
Definition: NativeSession.cpp:286
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:256
PDBSymbolCompiland.h
llvm::pdb::NativeSession::addressForVA
bool addressForVA(uint64_t VA, uint32_t &Section, uint32_t &Offset) const override
Definition: NativeSession.cpp:220
BinaryStreamArray.h
llvm::HexStyle::Style
Style
Definition: MCInstPrinter.h:32
IPDBEnumChildren.h
MappedBlockStream.h
llvm::pdb::NativeSession::addressForRVA
bool addressForRVA(uint32_t RVA, uint32_t &Section, uint32_t &Offset) const override
Definition: NativeSession.cpp:226
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:1836
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:1172
llvm::pdb::NativeSession::getGlobalScope
std::unique_ptr< PDBSymbolExe > getGlobalScope() override
Definition: NativeSession.cpp:211
getPdbPathFromExe
static Expected< std::string > getPdbPathFromExe(StringRef ExePath)
Definition: NativeSession.cpp:131
llvm::pdb::NativeSession::findSymbolBySectOffset
std::unique_ptr< PDBSymbol > findSymbolBySectOffset(uint32_t Sect, uint32_t Offset, PDB_SymType Type) override
Definition: NativeSession.cpp:265
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:1690
llvm::pdb::NativeSession::getSymbolById
std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const override
Definition: NativeSession.cpp:216
llvm::IntervalMap::end
const_iterator end() const
Definition: IntervalMap.h:1158
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::msf::Magic
static const char Magic[]
Definition: MSFCommon.h:23
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:566
uint32_t
IPDBSourceFile.h
ISectionContribVisitor.h
MSFCommon.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:249
llvm::pdb::NativeSession::~NativeSession
~NativeSession() override
std
Definition: BitVector.h:851
loadPdbFile
static Expected< std::unique_ptr< PDBFile > > loadPdbFile(StringRef PdbPath, std::unique_ptr< BumpPtrAllocator > &Allocator)
Definition: NativeSession.cpp:92
uint16_t
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::pdb::DbiModuleDescriptor::getModuleStreamIndex
uint16_t getModuleStreamIndex() const
Definition: DbiModuleDescriptor.cpp:48
llvm::object::COFFObjectFile
Definition: COFF.h:788
ModuleDebugStream.h
llvm::pdb::NativeSession
Definition: NativeSession.h:32
llvm::pdb::NativeSession::searchForPdb
static Expected< std::string > searchForPdb(const PdbSearchOptions &Opts)
Definition: NativeSession.cpp:173
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition: Error.h:596
Binary.h
llvm::Pattern
Definition: FileCheckImpl.h:614
llvm::sys::path::filename
StringRef filename(StringRef path, Style style=Style::native)
Get filename.
Definition: Path.cpp:577
COFF.h
llvm::pdb::PDBFile
Definition: PDBFile.h:40
PDBFile.h
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:143
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:312
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:45
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:474
llvm::pdb::NativeSession::findLineNumbers
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const override
Definition: NativeSession.cpp:274
DbiModuleList.h
llvm::pdb::SymbolCache::getNativeSymbolById
NativeRawSymbol & getNativeSymbolById(SymIndexId SymbolId) const
Definition: SymbolCache.cpp:263
llvm::ARMBuildAttrs::File
@ File
Definition: ARMBuildAttributes.h:36
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:33
llvm::pdb::NativeSession::getNativeGlobalScope
NativeExeSymbol & getNativeGlobalScope() const
Definition: NativeSession.cpp:375
llvm::pdb::NativeSession::getAllSourceFiles
std::unique_ptr< IPDBEnumSourceFiles > getAllSourceFiles() const override
Definition: NativeSession.cpp:323
llvm::pdb::NativeSession::getDebugStreams
std::unique_ptr< IPDBEnumDataStreams > getDebugStreams() const override
Definition: NativeSession.cpp:337
NativeExeSymbol.h
llvm::pdb::NativeSession::findOneCompilandForSourceFile
std::unique_ptr< PDBSymbolCompiland > findOneCompilandForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: NativeSession.cpp:318
llvm::pdb::SymbolCache::findLineNumbersByVA
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByVA(uint64_t VA, uint32_t Length) const
Definition: SymbolCache.cpp:533
llvm::pdb::NativeSession::moduleIndexForSectOffset
bool moduleIndexForSectOffset(uint32_t Sect, uint32_t Offset, uint16_t &ModuleIndex) const
Definition: NativeSession.cpp:411
NativeSession.h