LLVM 20.0.0git
GsymReader.cpp
Go to the documentation of this file.
1//===- GsymReader.cpp -----------------------------------------------------===//
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 <assert.h>
12#include <inttypes.h>
13#include <stdio.h>
14#include <stdlib.h>
15
22
23using namespace llvm;
24using namespace gsym;
25
26GsymReader::GsymReader(std::unique_ptr<MemoryBuffer> Buffer)
27 : MemBuffer(std::move(Buffer)), Endian(llvm::endianness::native) {}
28
29GsymReader::GsymReader(GsymReader &&RHS) = default;
30
31GsymReader::~GsymReader() = default;
32
34 // Open the input file and return an appropriate error if needed.
37 auto Err = BuffOrErr.getError();
38 if (Err)
39 return llvm::errorCodeToError(Err);
40 return create(BuffOrErr.get());
41}
42
44 auto MemBuffer = MemoryBuffer::getMemBufferCopy(Bytes, "GSYM bytes");
45 return create(MemBuffer);
46}
47
49GsymReader::create(std::unique_ptr<MemoryBuffer> &MemBuffer) {
50 if (!MemBuffer)
51 return createStringError(std::errc::invalid_argument,
52 "invalid memory buffer");
53 GsymReader GR(std::move(MemBuffer));
54 llvm::Error Err = GR.parse();
55 if (Err)
56 return std::move(Err);
57 return std::move(GR);
58}
59
61GsymReader::parse() {
62 BinaryStreamReader FileData(MemBuffer->getBuffer(), llvm::endianness::native);
63 // Check for the magic bytes. This file format is designed to be mmap'ed
64 // into a process and accessed as read only. This is done for performance
65 // and efficiency for symbolicating and parsing GSYM data.
66 if (FileData.readObject(Hdr))
67 return createStringError(std::errc::invalid_argument,
68 "not enough data for a GSYM header");
69
70 const auto HostByteOrder = llvm::endianness::native;
71 switch (Hdr->Magic) {
72 case GSYM_MAGIC:
73 Endian = HostByteOrder;
74 break;
75 case GSYM_CIGAM:
76 // This is a GSYM file, but not native endianness.
79 Swap.reset(new SwappedData);
80 break;
81 default:
82 return createStringError(std::errc::invalid_argument,
83 "not a GSYM file");
84 }
85
86 bool DataIsLittleEndian = HostByteOrder != llvm::endianness::little;
87 // Read a correctly byte swapped header if we need to.
88 if (Swap) {
89 DataExtractor Data(MemBuffer->getBuffer(), DataIsLittleEndian, 4);
90 if (auto ExpectedHdr = Header::decode(Data))
91 Swap->Hdr = ExpectedHdr.get();
92 else
93 return ExpectedHdr.takeError();
94 Hdr = &Swap->Hdr;
95 }
96
97 // Detect errors in the header and report any that are found. If we make it
98 // past this without errors, we know we have a good magic value, a supported
99 // version number, verified address offset size and a valid UUID size.
100 if (Error Err = Hdr->checkForError())
101 return Err;
102
103 if (!Swap) {
104 // This is the native endianness case that is most common and optimized for
105 // efficient lookups. Here we just grab pointers to the native data and
106 // use ArrayRef objects to allow efficient read only access.
107
108 // Read the address offsets.
109 if (FileData.padToAlignment(Hdr->AddrOffSize) ||
110 FileData.readArray(AddrOffsets,
111 Hdr->NumAddresses * Hdr->AddrOffSize))
112 return createStringError(std::errc::invalid_argument,
113 "failed to read address table");
114
115 // Read the address info offsets.
116 if (FileData.padToAlignment(4) ||
117 FileData.readArray(AddrInfoOffsets, Hdr->NumAddresses))
118 return createStringError(std::errc::invalid_argument,
119 "failed to read address info offsets table");
120
121 // Read the file table.
122 uint32_t NumFiles = 0;
123 if (FileData.readInteger(NumFiles) || FileData.readArray(Files, NumFiles))
124 return createStringError(std::errc::invalid_argument,
125 "failed to read file table");
126
127 // Get the string table.
128 FileData.setOffset(Hdr->StrtabOffset);
129 if (FileData.readFixedString(StrTab.Data, Hdr->StrtabSize))
130 return createStringError(std::errc::invalid_argument,
131 "failed to read string table");
132} else {
133 // This is the non native endianness case that is not common and not
134 // optimized for lookups. Here we decode the important tables into local
135 // storage and then set the ArrayRef objects to point to these swapped
136 // copies of the read only data so lookups can be as efficient as possible.
137 DataExtractor Data(MemBuffer->getBuffer(), DataIsLittleEndian, 4);
138
139 // Read the address offsets.
140 uint64_t Offset = alignTo(sizeof(Header), Hdr->AddrOffSize);
141 Swap->AddrOffsets.resize(Hdr->NumAddresses * Hdr->AddrOffSize);
142 switch (Hdr->AddrOffSize) {
143 case 1:
144 if (!Data.getU8(&Offset, Swap->AddrOffsets.data(), Hdr->NumAddresses))
145 return createStringError(std::errc::invalid_argument,
146 "failed to read address table");
147 break;
148 case 2:
149 if (!Data.getU16(&Offset,
150 reinterpret_cast<uint16_t *>(Swap->AddrOffsets.data()),
151 Hdr->NumAddresses))
152 return createStringError(std::errc::invalid_argument,
153 "failed to read address table");
154 break;
155 case 4:
156 if (!Data.getU32(&Offset,
157 reinterpret_cast<uint32_t *>(Swap->AddrOffsets.data()),
158 Hdr->NumAddresses))
159 return createStringError(std::errc::invalid_argument,
160 "failed to read address table");
161 break;
162 case 8:
163 if (!Data.getU64(&Offset,
164 reinterpret_cast<uint64_t *>(Swap->AddrOffsets.data()),
165 Hdr->NumAddresses))
166 return createStringError(std::errc::invalid_argument,
167 "failed to read address table");
168 }
169 AddrOffsets = ArrayRef<uint8_t>(Swap->AddrOffsets);
170
171 // Read the address info offsets.
172 Offset = alignTo(Offset, 4);
173 Swap->AddrInfoOffsets.resize(Hdr->NumAddresses);
174 if (Data.getU32(&Offset, Swap->AddrInfoOffsets.data(), Hdr->NumAddresses))
175 AddrInfoOffsets = ArrayRef<uint32_t>(Swap->AddrInfoOffsets);
176 else
177 return createStringError(std::errc::invalid_argument,
178 "failed to read address table");
179 // Read the file table.
180 const uint32_t NumFiles = Data.getU32(&Offset);
181 if (NumFiles > 0) {
182 Swap->Files.resize(NumFiles);
183 if (Data.getU32(&Offset, &Swap->Files[0].Dir, NumFiles*2))
184 Files = ArrayRef<FileEntry>(Swap->Files);
185 else
186 return createStringError(std::errc::invalid_argument,
187 "failed to read file table");
188 }
189 // Get the string table.
190 StrTab.Data = MemBuffer->getBuffer().substr(Hdr->StrtabOffset,
191 Hdr->StrtabSize);
192 if (StrTab.Data.empty())
193 return createStringError(std::errc::invalid_argument,
194 "failed to read string table");
195 }
196 return Error::success();
197
198}
199
201 // The only way to get a GsymReader is from GsymReader::openFile(...) or
202 // GsymReader::copyBuffer() and the header must be valid and initialized to
203 // a valid pointer value, so the assert below should not trigger.
204 assert(Hdr);
205 return *Hdr;
206}
207
208std::optional<uint64_t> GsymReader::getAddress(size_t Index) const {
209 switch (Hdr->AddrOffSize) {
210 case 1: return addressForIndex<uint8_t>(Index);
211 case 2: return addressForIndex<uint16_t>(Index);
212 case 4: return addressForIndex<uint32_t>(Index);
213 case 8: return addressForIndex<uint64_t>(Index);
214 }
215 return std::nullopt;
216}
217
218std::optional<uint64_t> GsymReader::getAddressInfoOffset(size_t Index) const {
219 const auto NumAddrInfoOffsets = AddrInfoOffsets.size();
220 if (Index < NumAddrInfoOffsets)
221 return AddrInfoOffsets[Index];
222 return std::nullopt;
223}
224
227 if (Addr >= Hdr->BaseAddress) {
228 const uint64_t AddrOffset = Addr - Hdr->BaseAddress;
229 std::optional<uint64_t> AddrOffsetIndex;
230 switch (Hdr->AddrOffSize) {
231 case 1:
232 AddrOffsetIndex = getAddressOffsetIndex<uint8_t>(AddrOffset);
233 break;
234 case 2:
235 AddrOffsetIndex = getAddressOffsetIndex<uint16_t>(AddrOffset);
236 break;
237 case 4:
238 AddrOffsetIndex = getAddressOffsetIndex<uint32_t>(AddrOffset);
239 break;
240 case 8:
241 AddrOffsetIndex = getAddressOffsetIndex<uint64_t>(AddrOffset);
242 break;
243 default:
244 return createStringError(std::errc::invalid_argument,
245 "unsupported address offset size %u",
246 Hdr->AddrOffSize);
247 }
248 if (AddrOffsetIndex)
249 return *AddrOffsetIndex;
250 }
251 return createStringError(std::errc::invalid_argument,
252 "address 0x%" PRIx64 " is not in GSYM", Addr);
253
254}
255
258 uint64_t &FuncStartAddr) const {
259 Expected<uint64_t> ExpectedAddrIdx = getAddressIndex(Addr);
260 if (!ExpectedAddrIdx)
261 return ExpectedAddrIdx.takeError();
262 const uint64_t FirstAddrIdx = *ExpectedAddrIdx;
263 // The AddrIdx is the first index of the function info entries that match
264 // \a Addr. We need to iterate over all function info objects that start with
265 // the same address until we find a range that contains \a Addr.
266 std::optional<uint64_t> FirstFuncStartAddr;
267 const size_t NumAddresses = getNumAddresses();
268 for (uint64_t AddrIdx = FirstAddrIdx; AddrIdx < NumAddresses; ++AddrIdx) {
269 auto ExpextedData = getFunctionInfoDataAtIndex(AddrIdx, FuncStartAddr);
270 // If there was an error, return the error.
271 if (!ExpextedData)
272 return ExpextedData;
273
274 // Remember the first function start address if it hasn't already been set.
275 // If it is already valid, check to see if it matches the first function
276 // start address and only continue if it matches.
277 if (FirstFuncStartAddr.has_value()) {
278 if (*FirstFuncStartAddr != FuncStartAddr)
279 break; // Done with consecutive function entries with same address.
280 } else {
281 FirstFuncStartAddr = FuncStartAddr;
282 }
283 // Make sure the current function address ranges contains \a Addr.
284 // Some symbols on Darwin don't have valid sizes, so if we run into a
285 // symbol with zero size, then we have found a match for our address.
286
287 // The first thing the encoding of a FunctionInfo object is the function
288 // size.
289 uint64_t Offset = 0;
290 uint32_t FuncSize = ExpextedData->getU32(&Offset);
291 if (FuncSize == 0 ||
292 AddressRange(FuncStartAddr, FuncStartAddr + FuncSize).contains(Addr))
293 return ExpextedData;
294 }
295 return createStringError(std::errc::invalid_argument,
296 "address 0x%" PRIx64 " is not in GSYM", Addr);
297}
298
301 uint64_t &FuncStartAddr) const {
302 if (AddrIdx >= getNumAddresses())
303 return createStringError(std::errc::invalid_argument,
304 "invalid address index %" PRIu64, AddrIdx);
305 const uint32_t AddrInfoOffset = AddrInfoOffsets[AddrIdx];
306 assert((Endian == endianness::big || Endian == endianness::little) &&
307 "Endian must be either big or little");
308 StringRef Bytes = MemBuffer->getBuffer().substr(AddrInfoOffset);
309 if (Bytes.empty())
310 return createStringError(std::errc::invalid_argument,
311 "invalid address info offset 0x%" PRIx32,
312 AddrInfoOffset);
313 std::optional<uint64_t> OptFuncStartAddr = getAddress(AddrIdx);
314 if (!OptFuncStartAddr)
315 return createStringError(std::errc::invalid_argument,
316 "failed to extract address[%" PRIu64 "]", AddrIdx);
317 FuncStartAddr = *OptFuncStartAddr;
318 return DataExtractor(Bytes, Endian == llvm::endianness::little, 4);
319}
320
322 uint64_t FuncStartAddr = 0;
323 if (auto ExpectedData = getFunctionInfoDataForAddress(Addr, FuncStartAddr))
324 return FunctionInfo::decode(*ExpectedData, FuncStartAddr);
325 else
326 return ExpectedData.takeError();
327}
328
331 uint64_t FuncStartAddr = 0;
332 if (auto ExpectedData = getFunctionInfoDataAtIndex(Idx, FuncStartAddr))
333 return FunctionInfo::decode(*ExpectedData, FuncStartAddr);
334 else
335 return ExpectedData.takeError();
336}
337
339 uint64_t FuncStartAddr = 0;
340 if (auto ExpectedData = getFunctionInfoDataForAddress(Addr, FuncStartAddr))
341 return FunctionInfo::lookup(*ExpectedData, *this, FuncStartAddr, Addr);
342 else
343 return ExpectedData.takeError();
344}
345
347 const auto &Header = getHeader();
348 // Dump the GSYM header.
349 OS << Header << "\n";
350 // Dump the address table.
351 OS << "Address Table:\n";
352 OS << "INDEX OFFSET";
353
354 switch (Hdr->AddrOffSize) {
355 case 1: OS << "8 "; break;
356 case 2: OS << "16"; break;
357 case 4: OS << "32"; break;
358 case 8: OS << "64"; break;
359 default: OS << "??"; break;
360 }
361 OS << " (ADDRESS)\n";
362 OS << "====== =============================== \n";
363 for (uint32_t I = 0; I < Header.NumAddresses; ++I) {
364 OS << format("[%4u] ", I);
365 switch (Hdr->AddrOffSize) {
366 case 1: OS << HEX8(getAddrOffsets<uint8_t>()[I]); break;
367 case 2: OS << HEX16(getAddrOffsets<uint16_t>()[I]); break;
368 case 4: OS << HEX32(getAddrOffsets<uint32_t>()[I]); break;
369 case 8: OS << HEX32(getAddrOffsets<uint64_t>()[I]); break;
370 default: break;
371 }
372 OS << " (" << HEX64(*getAddress(I)) << ")\n";
373 }
374 // Dump the address info offsets table.
375 OS << "\nAddress Info Offsets:\n";
376 OS << "INDEX Offset\n";
377 OS << "====== ==========\n";
378 for (uint32_t I = 0; I < Header.NumAddresses; ++I)
379 OS << format("[%4u] ", I) << HEX32(AddrInfoOffsets[I]) << "\n";
380 // Dump the file table.
381 OS << "\nFiles:\n";
382 OS << "INDEX DIRECTORY BASENAME PATH\n";
383 OS << "====== ========== ========== ==============================\n";
384 for (uint32_t I = 0; I < Files.size(); ++I) {
385 OS << format("[%4u] ", I) << HEX32(Files[I].Dir) << ' '
386 << HEX32(Files[I].Base) << ' ';
387 dump(OS, getFile(I));
388 OS << "\n";
389 }
390 OS << "\n" << StrTab << "\n";
391
392 for (uint32_t I = 0; I < Header.NumAddresses; ++I) {
393 OS << "FunctionInfo @ " << HEX32(AddrInfoOffsets[I]) << ": ";
394 if (auto FI = getFunctionInfoAtIndex(I))
395 dump(OS, *FI);
396 else
397 logAllUnhandledErrors(FI.takeError(), OS, "FunctionInfo:");
398 }
399}
400
402 uint32_t Indent) {
403 OS.indent(Indent);
404 OS << FI.Range << " \"" << getString(FI.Name) << "\"\n";
405 if (FI.OptLineTable)
406 dump(OS, *FI.OptLineTable, Indent);
407 if (FI.Inline)
408 dump(OS, *FI.Inline, Indent);
409
410 if (FI.MergedFunctions) {
411 assert(Indent == 0 && "MergedFunctionsInfo should only exist at top level");
412 dump(OS, *FI.MergedFunctions);
413 }
414}
415
417 for (uint32_t inx = 0; inx < MFI.MergedFunctions.size(); inx++) {
418 OS << "++ Merged FunctionInfos[" << inx << "]:\n";
419 dump(OS, MFI.MergedFunctions[inx], 4);
420 }
421}
422
424 OS.indent(Indent);
425 OS << "LineTable:\n";
426 for (auto &LE: LT) {
427 OS.indent(Indent);
428 OS << " " << HEX64(LE.Addr) << ' ';
429 if (LE.File)
430 dump(OS, getFile(LE.File));
431 OS << ':' << LE.Line << '\n';
432 }
433}
434
436 if (Indent == 0)
437 OS << "InlineInfo:\n";
438 else
439 OS.indent(Indent);
440 OS << II.Ranges << ' ' << getString(II.Name);
441 if (II.CallFile != 0) {
442 if (auto File = getFile(II.CallFile)) {
443 OS << " called from ";
444 dump(OS, File);
445 OS << ':' << II.CallLine;
446 }
447 }
448 OS << '\n';
449 for (const auto &ChildII: II.Children)
450 dump(OS, ChildII, Indent + 2);
451}
452
453void GsymReader::dump(raw_ostream &OS, std::optional<FileEntry> FE) {
454 if (FE) {
455 // IF we have the file from index 0, then don't print anything
456 if (FE->Dir == 0 && FE->Base == 0)
457 return;
458 StringRef Dir = getString(FE->Dir);
459 StringRef Base = getString(FE->Base);
460 if (!Dir.empty()) {
461 OS << Dir;
462 if (Dir.contains('\\') && !Dir.contains('/'))
463 OS << '\\';
464 else
465 OS << '/';
466 }
467 if (!Base.empty()) {
468 OS << Base;
469 }
470 if (!Dir.empty() || !Base.empty())
471 return;
472 }
473 OS << "<invalid-file>";
474}
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
uint64_t Addr
#define HEX64(v)
Definition: ExtractRanges.h:20
#define HEX32(v)
Definition: ExtractRanges.h:19
#define I(x, y, z)
Definition: MD5.cpp:58
uint64_t IntrinsicInst * II
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
endianness Endian
raw_pwrite_stream & OS
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Definition: Value.cpp:469
A class that represents an address range.
Definition: AddressRanges.h:22
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:165
Provides read only access to a subclass of BinaryStream.
Represents either an error or a value T.
Definition: ErrorOr.h:56
reference get()
Definition: ErrorOr.h:149
std::error_code getError() const
Definition: ErrorOr.h:152
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:337
Tagged union holding either a T or a Error.
Definition: Error.h:481
Error takeError()
Take ownership of the stored error.
Definition: Error.h:608
static std::unique_ptr< MemoryBuffer > getMemBufferCopy(StringRef InputData, const Twine &BufferName="")
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
GsymReader is used to read GSYM data from a file or buffer.
Definition: GsymReader.h:44
std::optional< FileEntry > getFile(uint32_t Index) const
Get the a file entry for the suppplied file index.
Definition: GsymReader.h:150
void dump(raw_ostream &OS)
Dump the entire Gsym data contained in this object.
Definition: GsymReader.cpp:346
uint32_t getNumAddresses() const
Get the number of addresses in this Gsym file.
Definition: GsymReader.h:222
static llvm::Expected< GsymReader > openFile(StringRef Path)
Construct a GsymReader from a file on disk.
Definition: GsymReader.cpp:33
std::optional< uint64_t > getAddress(size_t Index) const
Gets an address from the address table.
Definition: GsymReader.cpp:208
std::optional< uint64_t > getAddressInfoOffset(size_t Index) const
Given an address index, get the offset for the FunctionInfo.
Definition: GsymReader.cpp:218
StringRef getString(uint32_t Offset) const
Get a string from the string table.
Definition: GsymReader.h:139
llvm::Expected< FunctionInfo > getFunctionInfo(uint64_t Addr) const
Get the full function info for an address.
Definition: GsymReader.cpp:321
const Header & getHeader() const
Access the GSYM header.
Definition: GsymReader.cpp:200
llvm::Expected< llvm::DataExtractor > getFunctionInfoDataAtIndex(uint64_t AddrIdx, uint64_t &FuncStartAddr) const
Get the function data and address given an address index.
Definition: GsymReader.cpp:300
Expected< uint64_t > getAddressIndex(const uint64_t Addr) const
Given an address, find the address index.
Definition: GsymReader.cpp:226
llvm::Expected< LookupResult > lookup(uint64_t Addr) const
Lookup an address in the a GSYM.
Definition: GsymReader.cpp:338
static llvm::Expected< GsymReader > copyBuffer(StringRef Bytes)
Construct a GsymReader from a buffer.
Definition: GsymReader.cpp:43
static llvm::Expected< llvm::gsym::GsymReader > create(std::unique_ptr< MemoryBuffer > &MemBuffer)
Create a GSYM from a memory buffer.
Definition: GsymReader.cpp:49
llvm::Expected< FunctionInfo > getFunctionInfoAtIndex(uint64_t AddrIdx) const
Get the full function info given an address index.
Definition: GsymReader.cpp:330
llvm::Expected< llvm::DataExtractor > getFunctionInfoDataForAddress(uint64_t Addr, uint64_t &FuncStartAddr) const
Given an address, find the correct function info data and function address.
Definition: GsymReader.cpp:257
LineTable class contains deserialized versions of line tables for each function's address ranges.
Definition: LineTable.h:118
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
constexpr uint32_t GSYM_MAGIC
Definition: Header.h:24
constexpr uint32_t GSYM_CIGAM
Definition: Header.h:25
constexpr bool IsBigEndianHost
Definition: SwapByteOrder.h:26
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
void logAllUnhandledErrors(Error E, raw_ostream &OS, Twine ErrorBanner={})
Log all errors (if any) in E to OS.
Definition: Error.cpp:65
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition: Error.h:1286
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:125
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition: Alignment.h:155
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:1849
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
Definition: Error.cpp:111
endianness
Definition: bit.h:70
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858
Function information in GSYM files encodes information for one contiguous address range.
Definition: FunctionInfo.h:89
std::optional< InlineInfo > Inline
Definition: FunctionInfo.h:93
std::optional< MergedFunctionsInfo > MergedFunctions
Definition: FunctionInfo.h:94
static llvm::Expected< LookupResult > lookup(DataExtractor &Data, const GsymReader &GR, uint64_t FuncAddr, uint64_t Addr)
Lookup an address within a FunctionInfo object's data stream.
uint32_t Name
String table offset in the string table.
Definition: FunctionInfo.h:91
std::optional< LineTable > OptLineTable
Definition: FunctionInfo.h:92
static llvm::Expected< FunctionInfo > decode(DataExtractor &Data, uint64_t BaseAddr)
Decode an object from a binary data stream.
The GSYM header.
Definition: Header.h:45
uint8_t AddrOffSize
The size in bytes of each address offset in the address offsets table.
Definition: Header.h:56
static llvm::Expected< Header > decode(DataExtractor &Data)
Decode an object from a binary data stream.
Definition: Header.cpp:64
uint32_t Magic
The magic bytes should be set to GSYM_MAGIC.
Definition: Header.h:49
uint32_t StrtabOffset
The file relative offset of the start of the string table for strings contained in the GSYM file.
Definition: Header.h:72
uint32_t StrtabSize
The size in bytes of the string table.
Definition: Header.h:80
llvm::Error checkForError() const
Check if a header is valid and return an error if anything is wrong.
Definition: Header.cpp:41
uint32_t NumAddresses
The number of addresses stored in the address offsets table.
Definition: Header.h:64
uint64_t BaseAddress
The 64 bit base address that all address offsets in the address offsets table are relative to.
Definition: Header.h:62
Inline information stores the name of the inline function along with an array of address ranges.
Definition: InlineInfo.h:59
std::vector< FunctionInfo > MergedFunctions