LLVM  11.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
llvm::gsym::InlineInfo Struct Reference

Inline information stores the name of the inline function along with an array of address ranges. More...

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

Collaboration diagram for llvm::gsym::InlineInfo:
Collaboration graph
[legend]

Public Types

using InlineArray = std::vector< const InlineInfo * >
 

Public Member Functions

 InlineInfo ()
 
void clear ()
 
bool isValid () const
 
llvm::Optional< InlineArraygetInlineStack (uint64_t Addr) const
 Lookup an address in the InlineInfo object. More...
 
llvm::Error encode (FileWriter &O, uint64_t BaseAddr) const
 Encode this InlineInfo object into FileWriter stream. More...
 

Static Public Member Functions

static llvm::Error lookup (const GsymReader &GR, DataExtractor &Data, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs)
 Lookup a single address within the inline info data. More...
 
static llvm::Expected< InlineInfodecode (DataExtractor &Data, uint64_t BaseAddr)
 Decode an InlineInfo object from a binary data stream. More...
 

Public Attributes

uint32_t Name
 String table offset in the string table. More...
 
uint32_t CallFile
 1 based file index in the file table. More...
 
uint32_t CallLine
 Source line number. More...
 
AddressRanges Ranges
 
std::vector< InlineInfoChildren
 

Detailed Description

Inline information stores the name of the inline function along with an array of address ranges.

It also stores the call file and call line that called this inline function. This allows us to unwind inline call stacks back to the inline or concrete function that called this function. Inlined functions contained in this function are stored in the "Children" variable. All address ranges must be sorted and all address ranges of all children must be contained in the ranges of this function. Any clients that encode information will need to ensure the ranges are all contined correctly or lookups could fail. Add ranges in these objects must be contained in the top level FunctionInfo address ranges as well.

ENCODING

When saved to disk, the inline info encodes all ranges to be relative to a parent address range. This will be the FunctionInfo's start address if the InlineInfo is directly contained in a FunctionInfo, or a the start address of the containing parent InlineInfo's first "Ranges" member. This allows address ranges to be efficiently encoded using ULEB128 encodings as we encode the offset and size of each range instead of full addresses. This also makes any encoded addresses easy to relocate as we just need to relocate the FunctionInfo's start address.

Definition at line 61 of file InlineInfo.h.

Member Typedef Documentation

◆ InlineArray

Definition at line 78 of file InlineInfo.h.

Constructor & Destructor Documentation

◆ InlineInfo()

llvm::gsym::InlineInfo::InlineInfo ( )
inline

Definition at line 68 of file InlineInfo.h.

Member Function Documentation

◆ clear()

void llvm::gsym::InlineInfo::clear ( )
inline

Definition at line 69 of file InlineInfo.h.

References llvm::gsym::AddressRanges::clear().

◆ decode()

llvm::Expected< InlineInfo > InlineInfo::decode ( DataExtractor Data,
uint64_t  BaseAddr 
)
static

Decode an InlineInfo object from a binary data stream.

Parameters
DataThe binary stream to read the data from. This object must have the data for the InlineInfo object starting at offset zero. The data can contain more data than needed.
BaseAddrThe base address to use when decoding all address ranges. This will be the FunctionInfo's start address if this object is directly contained in a FunctionInfo object, or the start address of the first address range in an InlineInfo object of this object is a child of another InlineInfo object.
Returns
An InlineInfo or an error describing the issue that was encountered during decoding.

Definition at line 222 of file InlineInfo.cpp.

References decode().

Referenced by llvm::gsym::FunctionInfo::decode(), and decode().

◆ encode()

llvm::Error InlineInfo::encode ( FileWriter O,
uint64_t  BaseAddr 
) const

Encode this InlineInfo object into FileWriter stream.

Parameters
OThe binary stream to write the data to at the current file position.
BaseAddrThe base address to use when encoding all address ranges. This will be the FunctionInfo's start address if this object is directly contained in a FunctionInfo object, or the start address of the first address range in an InlineInfo object of this object is a child of another InlineInfo object.
Returns
An error object that indicates success or failure or the encoding process.

Definition at line 228 of file InlineInfo.cpp.

References CallFile, CallLine, Children, llvm::gsym::AddressRanges::contains(), llvm::createStringError(), llvm::gsym::AddressRanges::encode(), isValid(), Name, Ranges, llvm::gsym::FileWriter::writeU32(), llvm::gsym::FileWriter::writeU8(), and llvm::gsym::FileWriter::writeULEB().

◆ getInlineStack()

llvm::Optional< InlineInfo::InlineArray > InlineInfo::getInlineStack ( uint64_t  Addr) const

Lookup an address in the InlineInfo object.

This function is used to symbolicate an inline call stack and can turn one address in the program into one or more inline call stacks and have the stack trace show the original call site from non-inlined code.

Parameters
Addrthe address to lookup
Returns
optional vector of InlineInfo objects that describe the inline call stack for a given address, false otherwise.

Definition at line 56 of file InlineInfo.cpp.

References getInlineStackHelper(), and llvm::None.

◆ isValid()

bool llvm::gsym::InlineInfo::isValid ( ) const
inline

Definition at line 76 of file InlineInfo.h.

References llvm::gsym::AddressRanges::empty().

Referenced by encode(), and llvm::gsym::operator<<().

◆ lookup()

llvm::Error InlineInfo::lookup ( const GsymReader GR,
DataExtractor Data,
uint64_t  BaseAddr,
uint64_t  Addr,
SourceLocations SrcLocs 
)
static

Lookup a single address within the inline info data.

Clients have the option to decode an entire InlineInfo object (using InlineInfo::decode() ) or just find the matching inline info using this function. The benefit of using this function is that only the information needed for the lookup will be extracted, other info can be skipped and parsing can stop as soon as the deepest match is found. This allows symbolication tools to be fast and efficient and avoid allocation costs when doing lookups.

This function will augment the SourceLocations array SrcLocs with any inline information that pertains to Addr. If no inline information exists for Addr, then SrcLocs will be left untouched. If there is inline information for Addr, then SrcLocs will be modifiied to contain the deepest most inline function's SourceLocation at index zero in the array and proceed up the the concrete function source file and line at the end of the array.

Parameters
GRThe GSYM reader that contains the string and file table that will be used to fill in the source locations.
DataThe binary stream to read the data from. This object must have the data for the LineTable object starting at offset zero. The data can contain more data than needed.
BaseAddrThe base address to use when decoding the line table. This will be the FunctionInfo's start address and will be used to decode the correct addresses for the inline information.
AddrThe address to lookup.
SrcLocsThe inline source locations that matches Addr. This array must be initialized with the matching line entry from the line table upon entry. The name of the concrete function must be supplied since it will get pushed to the last SourceLocation entry and the inline information will fill in the source file and line from the inline information.
Returns
An error if the inline information is corrupt, or Error::success() for all other cases, even when no information is added to SrcLocs.

Definition at line 159 of file InlineInfo.cpp.

Member Data Documentation

◆ CallFile

uint32_t llvm::gsym::InlineInfo::CallFile

1 based file index in the file table.

Definition at line 64 of file InlineInfo.h.

Referenced by decode(), llvm::gsym::GsymReader::dump(), encode(), llvm::gsym::operator<<(), llvm::gsym::operator==(), and parseInlineInfo().

◆ CallLine

uint32_t llvm::gsym::InlineInfo::CallLine

Source line number.

Definition at line 65 of file InlineInfo.h.

Referenced by decode(), llvm::gsym::GsymReader::dump(), encode(), llvm::gsym::operator==(), and parseInlineInfo().

◆ Children

std::vector<InlineInfo> llvm::gsym::InlineInfo::Children

◆ Name

uint32_t llvm::gsym::InlineInfo::Name

String table offset in the string table.

Definition at line 63 of file InlineInfo.h.

Referenced by decode(), llvm::gsym::GsymReader::dump(), encode(), getInlineStackHelper(), llvm::gsym::operator<<(), llvm::gsym::operator==(), and parseInlineInfo().

◆ Ranges

AddressRanges llvm::gsym::InlineInfo::Ranges

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