struct FunctionInfo
Declaration
struct FunctionInfo { /* full declaration omitted */ };
Description
Function information in GSYM files encodes information for one contiguous address range. If a function has discontiguous address ranges, they will need to be encoded using multiple FunctionInfo objects. ENCODING The function information gets the function start address as an argument to the FunctionInfo::decode(...) function. This information is calculated from the GSYM header and an address offset from the GSYM address offsets table. The encoded FunctionInfo information must be aligned to a 4 byte boundary. The encoded data for a FunctionInfo starts with fixed data that all function info objects have: ENCODING NAME DESCRIPTION ========= =========== ==================================================== uint32_t Size The size in bytes of this function. uint32_t Name The string table offset of the function name. The optional data in a FunctionInfo object follows this fixed information and consists of a stream of tuples that consist of: ENCODING NAME DESCRIPTION ========= =========== ==================================================== uint32_t InfoType An "InfoType" enumeration that describes the type of optional data that is encoded. uint32_t InfoLength The size in bytes of the encoded data that immediately follows this length if this value is greater than zero. uint8_t[] InfoData Encoded bytes that represent the data for the "InfoType". These bytes are only present if "InfoLength" is greater than zero. The "InfoType" is an enumeration: enum InfoType { EndOfList = 0u, LineTableInfo = 1u, InlineInfo = 2u }; This stream of tuples is terminated by a "InfoType" whose value is InfoType::EndOfList and a zero for "InfoLength". This signifies the end of the optional information list. This format allows us to add new optional information data to a FunctionInfo object over time and allows older clients to still parse the format and skip over any data that they don't understand or want to parse. So the function information encoding essientially looks like: struct { uint32_t Size; uint32_t Name; struct { uint32_t InfoType; uint32_t InfoLength; uint8_t InfoData[InfoLength]; }[N]; } Where "N" is the number of tuples.
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:88
Member Variables
- public llvm::gsym::AddressRange Range
- public uint32_t Name
- String table offset in the string table.
- public llvm::Optional<LineTable> OptLineTable
- public llvm::Optional<InlineInfo> Inline
Method Overview
- public FunctionInfo(uint64_t Addr = 0, uint64_t Size = 0, uint32_t N = 0)
- public void clear()
- public static llvm::Expected<FunctionInfo> decode(llvm::DataExtractor & Data, uint64_t BaseAddr)
- public llvm::Expected<uint64_t> encode(llvm::gsym::FileWriter & O) const
- public uint64_t endAddress() const
- public bool hasRichInfo() const
- public bool isValid() const
- public static llvm::Expected<LookupResult> lookup(llvm::DataExtractor & Data, const llvm::gsym::GsymReader & GR, uint64_t FuncAddr, uint64_t Addr)
- public void setEndAddress(uint64_t Addr)
- public void setSize(uint64_t Size)
- public void setStartAddress(uint64_t Addr)
- public uint64_t size() const
- public uint64_t startAddress() const
Methods
¶FunctionInfo(uint64_t Addr = 0,
uint64_t Size = 0,
uint32_t N = 0)
FunctionInfo(uint64_t Addr = 0,
uint64_t Size = 0,
uint32_t N = 0)
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:94
Parameters
- uint64_t Addr = 0
- uint64_t Size = 0
- uint32_t N = 0
¶void clear()
void clear()
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:179
¶static llvm::Expected<FunctionInfo> decode(
llvm::DataExtractor& Data,
uint64_t BaseAddr)
static llvm::Expected<FunctionInfo> decode(
llvm::DataExtractor& Data,
uint64_t BaseAddr)
Description
Decode an object from a binary data stream.
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:133
Parameters
- llvm::DataExtractor& Data
- The binary stream to read the data from. This object must have the data for the object starting at offset zero. The data can contain more data than needed.
- uint64_t BaseAddr
- The FunctionInfo's start address and will be used as the base address when decoding any contained information like the line table and the inline info.
Returns
An FunctionInfo or an error describing the issue that was encountered during decoding.
¶llvm::Expected<uint64_t> encode(
llvm::gsym::FileWriter& O) const
llvm::Expected<uint64_t> encode(
llvm::gsym::FileWriter& O) const
Description
Encode this object into FileWriter stream.
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:143
Parameters
- llvm::gsym::FileWriter& O
- The binary stream to write the data to at the current file position.
Returns
An error object that indicates failure or the offset of the function info that was successfully written into the stream.
¶uint64_t endAddress() const
uint64_t endAddress() const
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:173
¶bool hasRichInfo() const
bool hasRichInfo() const
Description
Query if a FunctionInfo has rich debug info.
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:104
Returns
A bool that indicates if this object has something else than range and name. When converting information from a symbol table and from debug info, we might end up with multiple FunctionInfo objects for the same range and we need to be able to tell which one is the better object to use.
¶bool isValid() const
bool isValid() const
Description
Query if a FunctionInfo object is valid. Address and size can be zero and there can be no line entries for a symbol so the only indication this entry is valid is if the name is not zero. This can happen when extracting information from symbol tables that do not encode symbol sizes. In that case only the address and name will be filled in.
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:117
Returns
A boolean indicating if this FunctionInfo is valid.
¶static llvm::Expected<LookupResult> lookup(
llvm::DataExtractor& Data,
const llvm::gsym::GsymReader& GR,
uint64_t FuncAddr,
uint64_t Addr)
static llvm::Expected<LookupResult> lookup(
llvm::DataExtractor& Data,
const llvm::gsym::GsymReader& GR,
uint64_t FuncAddr,
uint64_t Addr)
Description
Lookup an address within a FunctionInfo object's data stream. Instead of decoding an entire FunctionInfo object when doing lookups, we can decode only the information we need from the FunctionInfo's data for the specific address. The lookup result information is returned as a LookupResult.
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:167
Parameters
- llvm::DataExtractor& Data
- The binary stream to read the data from. This object must have the data for the object starting at offset zero. The data can contain more data than needed.
- const llvm::gsym::GsymReader& GR
- The GSYM reader that contains the string and file table that will be used to fill in information in the returned result.
- uint64_t FuncAddr
- The function start address decoded from the GsymReader.
- uint64_t Addr
- The address to lookup.
Returns
An LookupResult or an error describing the issue that was encountered during decoding. An error should only be returned if the address is not contained in the FunctionInfo or if the data is corrupted.
¶void setEndAddress(uint64_t Addr)
void setEndAddress(uint64_t Addr)
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:176
Parameters
- uint64_t Addr
¶void setSize(uint64_t Size)
void setSize(uint64_t Size)
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:177
Parameters
- uint64_t Size
¶void setStartAddress(uint64_t Addr)
void setStartAddress(uint64_t Addr)
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:175
Parameters
- uint64_t Addr
¶uint64_t size() const
uint64_t size() const
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:174
¶uint64_t startAddress() const
uint64_t startAddress() const
Declared at: llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h:172