LLVM 23.0.0git
llvm::gsym::GsymReaderV1 Class Reference

GsymReaderV1 reads GSYM V1 data from a buffer. More...

#include "llvm/DebugInfo/GSYM/GsymReaderV1.h"

Inheritance diagram for llvm::gsym::GsymReaderV1:
[legend]

Public Member Functions

 GsymReaderV1 (GsymReaderV1 &&RHS)=default
 ~GsymReaderV1 () override=default
uint16_t getVersion () const override
 Get the GSYM version for this reader.
uint64_t getBaseAddress () const override
 Get the base address of this GSYM file.
uint64_t getNumAddresses () const override
 Get the number of addresses in this GSYM file.
uint8_t getAddressOffsetSize () const override
 Get the address offset byte size for this GSYM file.
uint8_t getAddressInfoOffsetSize () const override
 Get the address info offset byte size for this GSYM file.
uint8_t getStringOffsetSize () const override
 Get the string offset byte size for this GSYM file.
LLVM_ABI void dump (raw_ostream &OS) override
 Dump the entire Gsym data contained in this object.
LLVM_ABI void dump (raw_ostream &OS, const FunctionInfo &FI, uint32_t Indent=0)
 Dump a FunctionInfo object.
LLVM_ABI void dump (raw_ostream &OS, const MergedFunctionsInfo &MFI)
 Dump a MergedFunctionsInfo object.
LLVM_ABI void dump (raw_ostream &OS, const CallSiteInfo &CSI)
 Dump a CallSiteInfo object.
LLVM_ABI void dump (raw_ostream &OS, const CallSiteInfoCollection &CSIC, uint32_t Indent=0)
 Dump a CallSiteInfoCollection object.
LLVM_ABI void dump (raw_ostream &OS, const LineTable &LT, uint32_t Indent=0)
 Dump a LineTable object.
LLVM_ABI void dump (raw_ostream &OS, const InlineInfo &II, uint32_t Indent=0)
 Dump a InlineInfo object.
LLVM_ABI void dump (raw_ostream &OS, std::optional< FileEntry > FE)
 Dump a FileEntry object.
Public Member Functions inherited from llvm::gsym::GsymReader
LLVM_ABI GsymReader (GsymReader &&RHS)=default
virtual ~GsymReader ()=default
bool isLittleEndian () const
LLVM_ABI llvm::Expected< FunctionInfogetFunctionInfo (uint64_t Addr) const
 Get the full function info for an address.
LLVM_ABI llvm::Expected< FunctionInfogetFunctionInfoAtIndex (uint64_t AddrIdx) const
 Get the full function info given an address index.
LLVM_ABI llvm::Expected< LookupResultlookup (uint64_t Addr, std::optional< GsymDataExtractor > *MergedFuncsData=nullptr) const
 Lookup an address in the a GSYM.
LLVM_ABI llvm::Expected< std::vector< LookupResult > > lookupAll (uint64_t Addr) const
 Lookup all merged functions for a given address.
StringRef getString (gsym_strp_t Offset) const
 Get a string from the string table.
std::optional< FileEntrygetFile (uint32_t Index) const
 Get the a file entry for the suppplied file index.
LLVM_ABI void dump (raw_ostream &OS, const FunctionInfo &FI, uint32_t Indent=0)
 Dump a FunctionInfo object.
LLVM_ABI void dump (raw_ostream &OS, const MergedFunctionsInfo &MFI)
 Dump a MergedFunctionsInfo object.
LLVM_ABI void dump (raw_ostream &OS, const CallSiteInfo &CSI)
 Dump a CallSiteInfo object.
LLVM_ABI void dump (raw_ostream &OS, const CallSiteInfoCollection &CSIC, uint32_t Indent=0)
 Dump a CallSiteInfoCollection object.
LLVM_ABI void dump (raw_ostream &OS, const LineTable &LT, uint32_t Indent=0)
 Dump a LineTable object.
LLVM_ABI void dump (raw_ostream &OS, const InlineInfo &II, uint32_t Indent=0)
 Dump a InlineInfo object.
LLVM_ABI void dump (raw_ostream &OS, std::optional< FileEntry > FE)
 Dump a FileEntry object.
LLVM_ABI std::optional< uint64_tgetAddress (size_t Index) const
 Gets an address from the address table.

Protected Member Functions

 GsymReaderV1 (std::unique_ptr< MemoryBuffer > Buffer, llvm::endianness Endian)
llvm::Error parseHeaderAndGlobalDataEntries () override
 Parse the version-specific header and populate GlobalDataSections.
Protected Member Functions inherited from llvm::gsym::GsymReader
 GsymReader (std::unique_ptr< MemoryBuffer > Buffer, llvm::endianness Endian)
LLVM_ABI std::optional< GlobalDatagetGlobalData (GlobalInfoType Type) const
 Get the GlobalData entry for a section type.
LLVM_ABI llvm::Expected< StringRefgetRequiredGlobalDataBytes (GlobalInfoType Type) const
 Get the raw bytes for a required GlobalData section as a StringRef.
LLVM_ABI std::optional< StringRefgetOptionalGlobalDataBytes (GlobalInfoType Type) const
 Get the raw bytes for an optional GlobalData section as a StringRef.
LLVM_ABI llvm::Error parse ()
 Parse the GSYM data from the memory buffer.
template<class HeaderT>
llvm::Error parseHeader (const HeaderT *&OutHdr, std::unique_ptr< HeaderT > &OutSwappedHdr)
 Parse and validate the header from the beginning of the memory buffer.
llvm::Error parseGlobalDataEntries (uint64_t Offset)
 Parse GlobalData entries starting at Offset into GlobalDataSections.
llvm::Error parseAddrOffsets (StringRef Bytes)
 Parse address offsets section bytes into AddrOffsets.
llvm::Error setAddrInfoOffsetsData (StringRef Bytes)
 Set address info offsets section bytes into AddrInfoOffsetsData.
llvm::Error setStringTableData (StringRef Bytes)
 Set string table section bytes into StrTab.
llvm::Error setFileTableData (StringRef Bytes)
 Set file table section bytes into FileEntryData.
template<class T>
ArrayRef< TgetAddrOffsets () const
 Get an appropriate address info offsets array.
template<class T>
std::optional< uint64_taddressForIndex (size_t Index) const
 Get an appropriate address from the address table.
template<class T>
std::optional< uint64_tgetAddressOffsetIndex (const uint64_t AddrOffset) const
 Lookup an address offset in the AddrOffsets table.
LLVM_ABI Expected< uint64_tgetAddressIndex (const uint64_t Addr) const
 Given an address, find the address index.
LLVM_ABI std::optional< uint64_tgetAddressInfoOffset (size_t Index) const
 Given an address index, get the offset for the FunctionInfo.
LLVM_ABI llvm::Expected< GsymDataExtractorgetFunctionInfoDataForAddress (uint64_t Addr, uint64_t &FuncStartAddr) const
 Given an address, find the correct function info data and function address.
LLVM_ABI llvm::Expected< GsymDataExtractorgetFunctionInfoDataAtIndex (uint64_t AddrIdx, uint64_t &FuncStartAddr) const
 Get the function data and address given an address index.

Friends

class GsymReader

Additional Inherited Members

Static Public Member Functions inherited from llvm::gsym::GsymReader
static LLVM_ABI llvm::Expected< std::unique_ptr< GsymReader > > openFile (StringRef Path)
 Construct a GsymReader from a file on disk.
static LLVM_ABI llvm::Expected< std::unique_ptr< GsymReader > > copyBuffer (StringRef Bytes)
 Construct a GsymReader from a buffer.
Static Protected Member Functions inherited from llvm::gsym::GsymReader
static LLVM_ABI llvm::Expected< std::unique_ptr< GsymReader > > create (std::unique_ptr< MemoryBuffer > &MemBuffer)
 Create a GSYM from a memory buffer.
Protected Attributes inherited from llvm::gsym::GsymReader
std::unique_ptr< MemoryBufferMemBuffer
llvm::endianness Endian
std::map< GlobalInfoType, GlobalDataGlobalDataSections
 Parsed GlobalData entries, keyed by type.
ArrayRef< uint8_tAddrOffsets
std::vector< uint8_tSwappedAddrOffsets
GsymDataExtractor AddrInfoOffsetsData
GsymDataExtractor FileEntryData
StringTable StrTab

Detailed Description

GsymReaderV1 reads GSYM V1 data from a buffer.

Definition at line 21 of file GsymReaderV1.h.

Constructor & Destructor Documentation

◆ GsymReaderV1() [1/2]

GsymReaderV1::GsymReaderV1 ( std::unique_ptr< MemoryBuffer > Buffer,
llvm::endianness Endian )
protected

Definition at line 21 of file GsymReaderV1.cpp.

References llvm::gsym::GsymReader::Endian, GsymReader, and llvm::move().

Referenced by GsymReaderV1().

◆ GsymReaderV1() [2/2]

llvm::gsym::GsymReaderV1::GsymReaderV1 ( GsymReaderV1 && RHS)
default

References GsymReaderV1(), and RHS.

◆ ~GsymReaderV1()

llvm::gsym::GsymReaderV1::~GsymReaderV1 ( )
overridedefault

Member Function Documentation

◆ dump() [1/8]

void GsymReaderV1::dump ( raw_ostream & OS)
overridevirtual

◆ dump() [2/8]

void GsymReader::dump ( raw_ostream & OS,
const CallSiteInfo & CSI )

Dump a CallSiteInfo object.

This function will output the details of a CallSiteInfo object in a human-readable format.

Parameters
OSThe output stream to dump to.
CSIThe CallSiteInfo object to dump.

Definition at line 233 of file GsymReader.cpp.

References llvm::Data, llvm::Offset, and llvm::gsym::GsymReader::SwappedAddrOffsets.

◆ dump() [3/8]

void GsymReader::dump ( raw_ostream & OS,
const CallSiteInfoCollection & CSIC,
uint32_t Indent = 0 )

Dump a CallSiteInfoCollection object.

This function will iterate over a collection of CallSiteInfo objects and dump each one.

Parameters
OSThe output stream to dump to.
CSICThe CallSiteInfoCollection object to dump.
IndentThe indentation as number of spaces. Used when dumping as an item from within MergedFunctionsInfo.

Definition at line 246 of file GsymReader.cpp.

◆ dump() [4/8]

void GsymReader::dump ( raw_ostream & OS,
const FunctionInfo & FI,
uint32_t Indent = 0 )

Dump a FunctionInfo object.

This function will convert any string table indexes and file indexes into human readable format.

Parameters
OSThe output stream to dump to.
FIThe object to dump.
IndentThe indentation as number of spaces. Used when dumping as an item within MergedFunctionsInfo.

Definition at line 212 of file GsymReader.cpp.

◆ dump() [5/8]

void GsymReader::dump ( raw_ostream & OS,
const InlineInfo & II,
uint32_t Indent = 0 )

Dump a InlineInfo object.

This function will convert any string table indexes and file indexes into human readable format.

Parameters
OSThe output stream to dump to.
IIThe object to dump.
IndentThe indentation as number of spaces. Used for recurive dumping.

Definition at line 274 of file GsymReader.cpp.

◆ dump() [6/8]

void GsymReader::dump ( raw_ostream & OS,
const LineTable & LT,
uint32_t Indent = 0 )

Dump a LineTable object.

This function will convert any string table indexes and file indexes into human readable format.

Parameters
OSThe output stream to dump to.
LTThe object to dump.
IndentThe indentation as number of spaces. Used when dumping as an item from within MergedFunctionsInfo.

Definition at line 261 of file GsymReader.cpp.

◆ dump() [7/8]

void GsymReader::dump ( raw_ostream & OS,
const MergedFunctionsInfo & MFI )

Dump a MergedFunctionsInfo object.

This function will dump a MergedFunctionsInfo object - basically by dumping the contained FunctionInfo objects with indentation.

Parameters
OSThe output stream to dump to.
MFIThe object to dump.

Definition at line 223 of file GsymReader.cpp.

References llvm::Data, llvm::Offset, and llvm::gsym::GsymReader::SwappedAddrOffsets.

◆ dump() [8/8]

void GsymReader::dump ( raw_ostream & OS,
std::optional< FileEntry > FE )

Dump a FileEntry object.

This function will convert any string table indexes into human readable format.

Parameters
OSThe output stream to dump to.
FEThe object to dump.

Definition at line 285 of file GsymReader.cpp.

References llvm::createStringError(), llvm::Data, llvm::StringRef::data(), llvm::gsym::GsymReader::getGlobalData(), llvm::gsym::getNameForGlobalInfoType(), and llvm::gsym::GsymReader::getOptionalGlobalDataBytes().

◆ getAddressInfoOffsetSize()

uint8_t llvm::gsym::GsymReaderV1::getAddressInfoOffsetSize ( ) const
inlineoverridevirtual

Get the address info offset byte size for this GSYM file.

Implements llvm::gsym::GsymReader.

Definition at line 39 of file GsymReaderV1.h.

References llvm::gsym::Header::getAddressInfoOffsetSize().

◆ getAddressOffsetSize()

uint8_t llvm::gsym::GsymReaderV1::getAddressOffsetSize ( ) const
inlineoverridevirtual

Get the address offset byte size for this GSYM file.

Implements llvm::gsym::GsymReader.

Definition at line 38 of file GsymReaderV1.h.

Referenced by dump().

◆ getBaseAddress()

uint64_t llvm::gsym::GsymReaderV1::getBaseAddress ( ) const
inlineoverridevirtual

Get the base address of this GSYM file.

Implements llvm::gsym::GsymReader.

Definition at line 36 of file GsymReaderV1.h.

◆ getNumAddresses()

uint64_t llvm::gsym::GsymReaderV1::getNumAddresses ( ) const
inlineoverridevirtual

Get the number of addresses in this GSYM file.

Implements llvm::gsym::GsymReader.

Definition at line 37 of file GsymReaderV1.h.

Referenced by dump().

◆ getStringOffsetSize()

uint8_t llvm::gsym::GsymReaderV1::getStringOffsetSize ( ) const
inlineoverridevirtual

Get the string offset byte size for this GSYM file.

Implements llvm::gsym::GsymReader.

Definition at line 42 of file GsymReaderV1.h.

References llvm::gsym::Header::getStringOffsetSize().

◆ getVersion()

uint16_t llvm::gsym::GsymReaderV1::getVersion ( ) const
inlineoverridevirtual

Get the GSYM version for this reader.

Implements llvm::gsym::GsymReader.

Definition at line 35 of file GsymReaderV1.h.

References llvm::gsym::Header::getVersion().

◆ parseHeaderAndGlobalDataEntries()

◆ GsymReader

friend class GsymReader
friend

Definition at line 22 of file GsymReaderV1.h.

References llvm::gsym::GsymReader::Endian, and GsymReader.

Referenced by GsymReader, and GsymReaderV1().


The documentation for this class was generated from the following files: