LLVM 22.0.0git
GlobalsStream.h
Go to the documentation of this file.
1//===- GlobalsStream.h - PDB Index of Symbols by Name -----------*- 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
9#ifndef LLVM_DEBUGINFO_PDB_NATIVE_GLOBALSSTREAM_H
10#define LLVM_DEBUGINFO_PDB_NATIVE_GLOBALSSTREAM_H
11
12#include "llvm/ADT/iterator.h"
17#include "llvm/Support/Endian.h"
18#include "llvm/Support/Error.h"
19
20namespace llvm {
22namespace msf {
24}
25namespace pdb {
26class SymbolStream;
27
28/// Iterator over hash records producing symbol record offsets. Abstracts away
29/// the fact that symbol record offsets on disk are off-by-one.
31 : public iterator_adaptor_base<
32 GSIHashIterator, FixedStreamArrayIterator<PSHashRecord>,
33 std::random_access_iterator_tag, const uint32_t> {
34public:
35 template <typename T>
38
40 uint32_t Off = this->I->Off;
41 return --Off;
42 }
43};
44
45/// From https://github.com/Microsoft/microsoft-pdb/blob/master/PDB/dbi/gsi.cpp
46enum : unsigned { IPHR_HASH = 4096 };
47
48/// A readonly view of a hash table used in the globals and publics streams.
49/// Most clients will only want to iterate this to get symbol record offsets
50/// into the PDB symbol stream.
70
72public:
73 LLVM_ABI explicit GlobalsStream(
74 std::unique_ptr<msf::MappedBlockStream> Stream);
76 const GSIHashTable &getGlobalsTable() const { return GlobalsTable; }
78
79 LLVM_ABI std::vector<std::pair<uint32_t, codeview::CVSymbol>>
81
82private:
83 GSIHashTable GlobalsTable;
84 std::unique_ptr<msf::MappedBlockStream> Stream;
85};
86} // namespace pdb
87}
88
89#endif
Lightweight arrays that are backed by an arbitrary BinaryStream.
#define LLVM_ABI
Definition Compiler.h:213
#define T
Provides read only access to a subclass of BinaryStream.
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
MappedBlockStream represents data stored in an MSF file into chunks of a particular size (called the ...
Iterator over hash records producing symbol record offsets.
uint32_t operator*() const
A readonly view of a hash table used in the globals and publics streams.
const GSIHashHeader * HashHdr
uint32_t getHashRecordSize() const
LLVM_ABI Error read(BinaryStreamReader &Reader)
uint32_t getNumBuckets() const
std::array< int32_t, IPHR_HASH+1 > BucketMap
FixedStreamArray< support::ulittle32_t > HashBuckets
FixedStreamArray< support::ulittle32_t > HashBitmap
uint32_t getVerSignature() const
GSIHashIterator begin() const
GSIHashIterator end() const
uint32_t getVerHeader() const
FixedStreamArray< PSHashRecord > HashRecords
LLVM_ABI std::vector< std::pair< uint32_t, codeview::CVSymbol > > findRecordsByName(StringRef Name, const SymbolStream &Symbols) const
LLVM_ABI GlobalsStream(std::unique_ptr< msf::MappedBlockStream > Stream)
const GSIHashTable & getGlobalsTable() const
This is an optimization pass for GlobalISel generic memory operations.
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:851
Header of the hash tables found in the globals and publics sections.
Definition RawTypes.h:28