LLVM: lib/DebugInfo/PDB/Native/PublicsStream.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

33#include

34

35using namespace llvm;

39

42

44

47 return Header->ISectThunkTable;

48}

50 return Header->OffThunkTable;

51}

52

53

54

55

56

57

60

61

65 "Publics Stream does not contain a header.");

66

67

70 "Publics Stream does not contain a header.");

71

72

73 if (auto E = PublicsTable.read(Reader))

74 return E;

75

76

77 uint32_t NumAddressMapEntries = Header->AddrMap / sizeof(uint32_t);

78 if (auto EC = Reader.readArray(AddressMap, NumAddressMapEntries))

81 "Could not read an address map."));

82

83

84 if (auto EC = Reader.readArray(ThunkMap, Header->NumThunks))

87 "Could not read a thunk map."));

88

89

91 if (auto EC = Reader.readArray(SectionOffsets, Header->NumSections))

94 "Could not read a section map."));

95 }

96

99 "Corrupted publics stream.");

101}

102

103

104

105std::optional<std::pair<codeview::PublicSym32, size_t>>

108

109

111 AddressMap, std::tuple(Segment, Offset),

114 if (Sym.kind() != codeview::S_PUB32)

115 return false;

116

117 auto Psym =

119 Sym);

120 if (!Psym) {

122 return false;

123 }

124

125 return std::tie(Psym->Segment, Psym->Offset) < Addr;

126 });

127

128 if (It == AddressMap.end())

129 return std::nullopt;

130

131 auto Sym = Symbols.readRecord(It->value());

132 if (Sym.kind() != codeview::S_PUB32)

133 return std::nullopt;

134

135 auto MaybePsym =

137 if (!MaybePsym) {

139 return std::nullopt;

140 }

142

143 if (std::tuple(Segment, Offset) != std::tuple(Psym.Segment, Psym.Offset))

144 return std::nullopt;

145

146 std::ptrdiff_t IterOffset = It - AddressMap.begin();

147 return std::pair{Psym, static_cast<size_t>(IterOffset)};

148}

Provides read only access to a subclass of BinaryStream.

Error readObject(const T *&Dest)

Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...

uint64_t bytesRemaining() const

Error readArray(ArrayRef< T > &Array, uint32_t NumElements)

Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

static Error deserializeAs(CVSymbol Symbol, T &Record)

LLVM_ABI uint32_t getSymHash() const

Definition PublicsStream.cpp:45

LLVM_ABI uint32_t getThunkTableOffset() const

Definition PublicsStream.cpp:49

LLVM_ABI Error reload()

Definition PublicsStream.cpp:58

LLVM_ABI ~PublicsStream()

LLVM_ABI PublicsStream(std::unique_ptr< msf::MappedBlockStream > Stream)

Definition PublicsStream.cpp:40

LLVM_ABI std::optional< std::pair< codeview::PublicSym32, size_t > > findByAddress(const SymbolStream &Symbols, uint16_t Segment, uint32_t Offset) const

Find a public symbol by a segment and offset.

Definition PublicsStream.cpp:106

LLVM_ABI uint16_t getThunkTableSection() const

Definition PublicsStream.cpp:46

detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t

This is an optimization pass for GlobalISel generic memory operations.

Error joinErrors(Error E1, Error E2)

Concatenate errors.

Error make_error(ArgTs &&... Args)

Make a Error instance representing failure using the given error info type.

auto lower_bound(R &&Range, T &&Value)

Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

void consumeError(Error Err)

Consume a Error without doing anything.

Implement std::hash so that hash_code can be used in STL containers.