9#ifndef LLVM_DEBUGINFO_GSYM_GSYMREADER_H
10#define LLVM_DEBUGINFO_GSYM_GSYMREADER_H
45 GsymReader(std::unique_ptr<MemoryBuffer> Buffer);
48 std::unique_ptr<MemoryBuffer> MemBuffer;
51 const Header *Hdr =
nullptr;
62 std::vector<uint8_t> AddrOffsets;
63 std::vector<uint32_t> AddrInfoOffsets;
64 std::vector<FileEntry> Files;
66 std::unique_ptr<SwappedData> Swap;
151 if (
Index < Files.size())
250 AddrOffsets.
size()/
sizeof(
T));
282 std::optional<uint64_t>
285 const auto Begin = AIO.
begin();
286 const auto End = AIO.
end();
287 auto Iter = std::lower_bound(Begin,
End, AddrOffset);
290 if (Iter == Begin && AddrOffset < *Begin)
292 if (Iter ==
End || AddrOffset < *Iter)
299 while (Iter != Begin) {
300 auto Prev = Iter - 1;
307 return std::distance(Begin, Iter);
320 create(std::unique_ptr<MemoryBuffer> &MemBuffer);
Provides ErrorOr<T> smart pointer.
uint64_t IntrinsicInst * II
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
GsymReader is used to read GSYM data from a file or buffer.
std::optional< FileEntry > getFile(uint32_t Index) const
Get the a file entry for the suppplied file index.
void dump(raw_ostream &OS)
Dump the entire Gsym data contained in this object.
uint32_t getNumAddresses() const
Get the number of addresses in this Gsym file.
static llvm::Expected< GsymReader > openFile(StringRef Path)
Construct a GsymReader from a file on disk.
std::optional< uint64_t > getAddress(size_t Index) const
Gets an address from the address table.
std::optional< uint64_t > getAddressInfoOffset(size_t Index) const
Given an address index, get the offset for the FunctionInfo.
ArrayRef< T > getAddrOffsets() const
Get an appropriate address info offsets array.
StringRef getString(uint32_t Offset) const
Get a string from the string table.
llvm::Expected< FunctionInfo > getFunctionInfo(uint64_t Addr) const
Get the full function info for an address.
const Header & getHeader() const
Access the GSYM header.
std::optional< uint64_t > addressForIndex(size_t Index) const
Get an appropriate address from the address table.
llvm::Expected< llvm::DataExtractor > getFunctionInfoDataAtIndex(uint64_t AddrIdx, uint64_t &FuncStartAddr) const
Get the function data and address given an address index.
Expected< uint64_t > getAddressIndex(const uint64_t Addr) const
Given an address, find the address index.
llvm::Expected< LookupResult > lookup(uint64_t Addr) const
Lookup an address in the a GSYM.
GsymReader(GsymReader &&RHS)
static llvm::Expected< GsymReader > copyBuffer(StringRef Bytes)
Construct a GsymReader from a buffer.
static llvm::Expected< llvm::gsym::GsymReader > create(std::unique_ptr< MemoryBuffer > &MemBuffer)
Create a GSYM from a memory buffer.
llvm::Expected< FunctionInfo > getFunctionInfoAtIndex(uint64_t AddrIdx) const
Get the full function info given an address index.
llvm::Expected< llvm::DataExtractor > getFunctionInfoDataForAddress(uint64_t Addr, uint64_t &FuncStartAddr) const
Given an address, find the correct function info data and function address.
std::optional< uint64_t > getAddressOffsetIndex(const uint64_t AddrOffset) const
Lookup an address offset in the AddrOffsets table.
LineTable class contains deserialized versions of line tables for each function's address ranges.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
Function information in GSYM files encodes information for one contiguous address range.
Inline information stores the name of the inline function along with an array of address ranges.
String tables in GSYM files are required to start with an empty string at offset zero.