9#ifndef LLVM_DEBUGINFO_GSYM_GSYMREADER_H
10#define LLVM_DEBUGINFO_GSYM_GSYMREADER_H
46 GsymReader(std::unique_ptr<MemoryBuffer> Buffer);
49 std::unique_ptr<MemoryBuffer> MemBuffer;
52 const Header *Hdr =
nullptr;
63 std::vector<uint8_t> AddrOffsets;
64 std::vector<uint32_t> AddrInfoOffsets;
65 std::vector<FileEntry> Files;
67 std::unique_ptr<SwappedData> Swap;
142 std::optional<DataExtractor> *MergedFuncsData =
nullptr)
const;
173 if (
Index < Files.size())
298 AddrOffsets.
size()/
sizeof(
T));
330 std::optional<uint64_t>
333 const auto Begin = AIO.
begin();
334 const auto End = AIO.
end();
335 auto Iter = std::lower_bound(Begin,
End, AddrOffset);
338 if (Iter == Begin && AddrOffset < *Begin)
340 if (Iter ==
End || AddrOffset < *Iter)
347 while (Iter != Begin) {
348 auto Prev = Iter - 1;
355 return std::distance(Begin, Iter);
368 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.
LLVM_ABI 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_ABI llvm::Expected< GsymReader > openFile(StringRef Path)
Construct a GsymReader from a file on disk.
LLVM_ABI std::optional< uint64_t > getAddress(size_t Index) const
Gets an address from the address table.
LLVM_ABI 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_ABI llvm::Expected< FunctionInfo > getFunctionInfo(uint64_t Addr) const
Get the full function info for an address.
LLVM_ABI 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_ABI llvm::Expected< llvm::DataExtractor > getFunctionInfoDataAtIndex(uint64_t AddrIdx, uint64_t &FuncStartAddr) const
Get the function data and address given an address index.
LLVM_ABI Expected< uint64_t > getAddressIndex(const uint64_t Addr) const
Given an address, find the address index.
LLVM_ABI GsymReader(GsymReader &&RHS)
static LLVM_ABI llvm::Expected< GsymReader > copyBuffer(StringRef Bytes)
Construct a GsymReader from a buffer.
LLVM_ABI llvm::Expected< LookupResult > lookup(uint64_t Addr, std::optional< DataExtractor > *MergedFuncsData=nullptr) const
Lookup an address in the a GSYM.
static LLVM_ABI llvm::Expected< llvm::gsym::GsymReader > create(std::unique_ptr< MemoryBuffer > &MemBuffer)
Create a GSYM from a memory buffer.
LLVM_ABI llvm::Expected< FunctionInfo > getFunctionInfoAtIndex(uint64_t AddrIdx) const
Get the full function info given an address index.
LLVM_ABI llvm::Expected< llvm::DataExtractor > getFunctionInfoDataForAddress(uint64_t Addr, uint64_t &FuncStartAddr) const
Given an address, find the correct function info data and function address.
LLVM_ABI llvm::Expected< std::vector< LookupResult > > lookupAll(uint64_t Addr) const
Lookup all merged functions for a given 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.