LLVM 23.0.0git
llvm::gsym Namespace Reference

Classes

struct  CallSiteInfo
struct  CallSiteInfoCollection
class  CallSiteInfoLoader
struct  CUInfo
class  DwarfTransformer
 A class that transforms the DWARF in a DWARFContext into GSYM information by populating the GsymCreator object that it is constructed with. More...
struct  FileEntry
 Files in GSYM are contained in FileEntry structs where we split the directory and basename into two different strings in the string table. More...
class  FileWriter
 A simplified binary data writer class that doesn't require targets, target definitions, architectures, or require any other optional compile time libraries to be enabled via the build process. More...
struct  FunctionInfo
 Function information in GSYM files encodes information for one contiguous address range. More...
struct  GlobalData
 GlobalData describes a section of data in a GSYM file by its type, file offset, and size. More...
class  GsymContext
 GSYM DI Context This data structure is the top level entity that deals with GSYM symbolication. More...
class  GsymCreator
 GsymCreator is used to emit GSYM data to a stand alone file or section within a file. More...
class  GsymCreatorV1
class  GsymCreatorV2
 GsymCreatorV2 emits GSYM V2 data with a GlobalData-based section layout. More...
class  GsymDataExtractor
 A DataExtractor subclass that adds GSYM-specific string offset support. More...
class  GsymReader
 GsymReader is used to read GSYM data from a file or buffer. More...
class  GsymReaderV1
 GsymReaderV1 reads GSYM V1 data from a buffer. More...
class  GsymReaderV2
 GsymReaderV2 reads GSYM V2 data from a buffer. More...
struct  Header
 The GSYM header. More...
struct  HeaderV2
 The GSYM V2 header. More...
struct  InlineInfo
 Inline information stores the name of the inline function along with an array of address ranges. More...
struct  LineEntry
 Line entries are used to encode the line tables in FunctionInfo objects. More...
class  LineTable
 LineTable class contains deserialized versions of line tables for each function's address ranges. More...
struct  LookupResult
struct  MergedFunctionsInfo
class  ObjectFileTransformer
class  OutputAggregator
struct  SourceLocation
struct  StringTable
 String tables in GSYM files are required to start with an empty string at offset zero. More...

Typedefs

typedef uint64_t gsym_strp_t
 The type of string offset used in the code.
using SourceLocations = std::vector<SourceLocation>

Enumerations

enum class  GlobalInfoType : uint32_t {
  EndOfList = 0u , AddrOffsets = 1u , AddrInfoOffsets = 2u , StringTable = 3u ,
  FileTable = 4u , FunctionInfo = 5u , UUID = 6u
}
 GlobalInfoType allows GSYM files to encode global information within a GSYM file in a way that is extensible for future versions of GSYM. More...
enum class  StringTableEncoding : uint8_t { Default = 0 }
 Encoding format for the string table. More...

Functions

LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const CallSiteInfo &CSI)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const CallSiteInfoCollection &CSIC)
LLVM_ABI void skipRange (GsymDataExtractor &Data, uint64_t &Offset)
 Skip an address range object in the specified data a the specified offset.
LLVM_ABI uint64_t skipRanges (GsymDataExtractor &Data, uint64_t &Offset)
 Skip an address range object in the specified data a the specified offset.
bool operator== (const FunctionInfo &LHS, const FunctionInfo &RHS)
bool operator!= (const FunctionInfo &LHS, const FunctionInfo &RHS)
bool operator< (const FunctionInfo &LHS, const FunctionInfo &RHS)
 This sorting will order things consistently by address range first, but then followed by increasing levels of debug info like inline information and line tables.
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const FunctionInfo &R)
LLVM_ABI StringRef getNameForGlobalInfoType (GlobalInfoType Type)
LLVM_ABI bool operator== (const Header &LHS, const Header &RHS)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const llvm::gsym::Header &H)
LLVM_ABI bool operator== (const HeaderV2 &LHS, const HeaderV2 &RHS)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const llvm::gsym::HeaderV2 &H)
bool operator== (const InlineInfo &LHS, const InlineInfo &RHS)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const InlineInfo &FI)
raw_ostreamoperator<< (raw_ostream &OS, const LineEntry &LE)
bool operator== (const LineEntry &LHS, const LineEntry &RHS)
bool operator!= (const LineEntry &LHS, const LineEntry &RHS)
bool operator< (const LineEntry &LHS, const LineEntry &RHS)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const gsym::LineTable &LT)
bool operator== (const SourceLocation &LHS, const SourceLocation &RHS)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const SourceLocation &R)
bool operator== (const LookupResult &LHS, const LookupResult &RHS)
LLVM_ABI raw_ostreamoperator<< (raw_ostream &OS, const LookupResult &R)
LLVM_ABI bool operator== (const MergedFunctionsInfo &LHS, const MergedFunctionsInfo &RHS)
void dump (raw_ostream &OS, const StringTable &S, uint8_t StringOffsetSize)
LLVM_ABI AddressRange decodeRange (GsymDataExtractor &Data, uint64_t BaseAddr, uint64_t &Offset)
 AddressRange objects are encoded and decoded to be relative to a base address.
LLVM_ABI void encodeRange (const AddressRange &Range, FileWriter &O, uint64_t BaseAddr)
LLVM_ABI void decodeRanges (AddressRanges &Ranges, GsymDataExtractor &Data, uint64_t BaseAddr, uint64_t &Offset)
 Address ranges are decoded and encoded to be relative to a base address.
LLVM_ABI void encodeRanges (const AddressRanges &Ranges, FileWriter &O, uint64_t BaseAddr)

Variables

constexpr uint32_t GSYM_MAGIC = 0x4753594d
constexpr uint32_t GSYM_CIGAM = 0x4d595347
constexpr size_t GSYM_MAX_UUID_SIZE = 20

Typedef Documentation

◆ gsym_strp_t

The type of string offset used in the code.

Note: This may be different from what's serialized into GSYM files, which is version dependent (e.g. V1 uses uint32_t, V2+ uses uint64_t).

Definition at line 21 of file GsymTypes.h.

◆ SourceLocations

Definition at line 37 of file LookupResult.h.

Enumeration Type Documentation

◆ GlobalInfoType

enum class llvm::gsym::GlobalInfoType : uint32_t
strong

GlobalInfoType allows GSYM files to encode global information within a GSYM file in a way that is extensible for future versions of GSYM.

It is designed to contain information needed by the GSYM encoding, along with any common data that FunctionInfo InfoType entries might require.

Enumerator
EndOfList 
AddrOffsets 
AddrInfoOffsets 
StringTable 
FileTable 
FunctionInfo 
UUID 

Definition at line 26 of file GlobalData.h.

◆ StringTableEncoding

Encoding format for the string table.

Enumerator
Default 

A list of NULL-terminated strings (same as V1).

The first string at offset zero must be the empty C string.

Definition at line 27 of file HeaderV2.h.

Function Documentation

◆ decodeRange()

AddressRange llvm::gsym::decodeRange ( GsymDataExtractor & Data,
uint64_t BaseAddr,
uint64_t & Offset )

AddressRange objects are encoded and decoded to be relative to a base address.

This will be the FunctionInfo's start address if the AddressRange is directly contained in a FunctionInfo, or a base address of the containing parent AddressRange or AddressRanges. 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 encoded addresses easy to relocate as we just need to relocate one base address.

Definition at line 23 of file ExtractRanges.cpp.

References llvm::Data, llvm::Offset, and Size.

Referenced by decodeRanges().

◆ decodeRanges()

void llvm::gsym::decodeRanges ( AddressRanges & Ranges,
GsymDataExtractor & Data,
uint64_t BaseAddr,
uint64_t & Offset )

Address ranges are decoded and encoded to be relative to a base address.

See the AddressRange comment for the encode and decode methods for full details.

Definition at line 41 of file ExtractRanges.cpp.

References llvm::Data, decodeRange(), and llvm::Offset.

Referenced by decode(), and lookup().

◆ dump()

◆ encodeRange()

void llvm::gsym::encodeRange ( const AddressRange & Range,
FileWriter & O,
uint64_t BaseAddr )

Definition at line 17 of file ExtractRanges.cpp.

References assert(), and Range.

Referenced by encodeRanges().

◆ encodeRanges()

void llvm::gsym::encodeRanges ( const AddressRanges & Ranges,
FileWriter & O,
uint64_t BaseAddr )

Definition at line 32 of file ExtractRanges.cpp.

References encodeRange(), and Range.

Referenced by llvm::gsym::InlineInfo::encode().

◆ getNameForGlobalInfoType()

◆ operator!=() [1/2]

bool llvm::gsym::operator!= ( const FunctionInfo & LHS,
const FunctionInfo & RHS )
inline

Definition at line 222 of file FunctionInfo.h.

References LHS, and RHS.

◆ operator!=() [2/2]

bool llvm::gsym::operator!= ( const LineEntry & LHS,
const LineEntry & RHS )
inline

Definition at line 39 of file LineEntry.h.

References LHS, and RHS.

◆ operator<() [1/2]

bool llvm::gsym::operator< ( const FunctionInfo & LHS,
const FunctionInfo & RHS )
inline

This sorting will order things consistently by address range first, but then followed by increasing levels of debug info like inline information and line tables.

We might end up with a FunctionInfo from debug info that will have the same range as one from the symbol table, but we want to quickly be able to sort and use the best version when creating the final GSYM file. This function compares the inline information as we have seen cases where LTO can generate a wide array of differing inline information, mostly due to messing up the address ranges for inlined functions, so the inline information with the most entries will appeear last. If the inline information match, either by both function infos not having any or both being exactly the same, we will then compare line tables. Comparing line tables allows the entry with the most line entries to appear last. This ensures we are able to save the FunctionInfo with the most debug info into the GSYM file.

Definition at line 239 of file FunctionInfo.h.

References LHS, and RHS.

◆ operator<() [2/2]

bool llvm::gsym::operator< ( const LineEntry & LHS,
const LineEntry & RHS )
inline

Definition at line 42 of file LineEntry.h.

References LHS, and RHS.

◆ operator<<() [1/10]

◆ operator<<() [2/10]

raw_ostream & llvm::gsym::operator<< ( raw_ostream & OS,
const CallSiteInfoCollection & CSIC )

Definition at line 239 of file CallSiteInfo.cpp.

References llvm::gsym::CallSiteInfoCollection::CallSites.

◆ operator<<() [3/10]

◆ operator<<() [4/10]

raw_ostream & llvm::gsym::operator<< ( raw_ostream & OS,
const gsym::LineTable & LT )

Definition at line 285 of file LineTable.cpp.

◆ operator<<() [5/10]

raw_ostream & llvm::gsym::operator<< ( raw_ostream & OS,
const InlineInfo & FI )

Definition at line 22 of file InlineInfo.cpp.

References HEX32, II, and llvm::interleaved().

◆ operator<<() [6/10]

raw_ostream & llvm::gsym::operator<< ( raw_ostream & OS,
const LineEntry & LE )
inline

Definition at line 31 of file LineEntry.h.

References llvm::format(), and HEX64.

◆ operator<<() [7/10]

raw_ostream & llvm::gsym::operator<< ( raw_ostream & OS,
const llvm::gsym::Header & H )

Definition at line 23 of file Header.cpp.

References llvm::format_hex_no_prefix(), H, HEX16, HEX32, HEX64, HEX8, and I.

◆ operator<<() [8/10]

raw_ostream & llvm::gsym::operator<< ( raw_ostream & OS,
const llvm::gsym::HeaderV2 & H )

Definition at line 23 of file HeaderV2.cpp.

References H, HEX16, HEX32, HEX64, and HEX8.

◆ operator<<() [9/10]

◆ operator<<() [10/10]

◆ operator==() [1/8]

bool llvm::gsym::operator== ( const FunctionInfo & LHS,
const FunctionInfo & RHS )
inline

Definition at line 218 of file FunctionInfo.h.

References LHS, and RHS.

◆ operator==() [2/8]

bool llvm::gsym::operator== ( const Header & LHS,
const Header & RHS )

Definition at line 101 of file Header.cpp.

◆ operator==() [3/8]

bool llvm::gsym::operator== ( const HeaderV2 & LHS,
const HeaderV2 & RHS )

Definition at line 89 of file HeaderV2.cpp.

◆ operator==() [4/8]

bool llvm::gsym::operator== ( const InlineInfo & LHS,
const InlineInfo & RHS )
inline

Definition at line 182 of file InlineInfo.h.

References LHS, and RHS.

◆ operator==() [5/8]

bool llvm::gsym::operator== ( const LineEntry & LHS,
const LineEntry & RHS )
inline

Definition at line 36 of file LineEntry.h.

References LHS, and RHS.

◆ operator==() [6/8]

bool llvm::gsym::operator== ( const LookupResult & LHS,
const LookupResult & RHS )
inline

Definition at line 83 of file LookupResult.h.

References LHS, and RHS.

◆ operator==() [7/8]

LLVM_ABI bool llvm::gsym::operator== ( const MergedFunctionsInfo & LHS,
const MergedFunctionsInfo & RHS )

References LHS, LLVM_ABI, and RHS.

◆ operator==() [8/8]

bool llvm::gsym::operator== ( const SourceLocation & LHS,
const SourceLocation & RHS )
inline

Definition at line 30 of file LookupResult.h.

References LHS, and RHS.

◆ skipRange()

void llvm::gsym::skipRange ( GsymDataExtractor & Data,
uint64_t & Offset )

Skip an address range object in the specified data a the specified offset.

Parameters
DataThe binary stream to read the data from.
OffsetThe byte offset within Data.

Definition at line 50 of file ExtractRanges.cpp.

References llvm::Data, and llvm::Offset.

Referenced by skipRanges().

◆ skipRanges()

uint64_t llvm::gsym::skipRanges ( GsymDataExtractor & Data,
uint64_t & Offset )

Skip an address range object in the specified data a the specified offset.

Parameters
DataThe binary stream to read the data from.
OffsetThe byte offset within Data.
Returns
The number of address ranges that were skipped.

Definition at line 55 of file ExtractRanges.cpp.

References llvm::Data, I, llvm::Offset, and skipRange().

Referenced by skip().

Variable Documentation

◆ GSYM_CIGAM

uint32_t llvm::gsym::GSYM_CIGAM = 0x4d595347
constexpr

Definition at line 26 of file Header.h.

Referenced by checkMagicAndDetectVersionEndian().

◆ GSYM_MAGIC

◆ GSYM_MAX_UUID_SIZE

size_t llvm::gsym::GSYM_MAX_UUID_SIZE = 20
constexpr

Definition at line 27 of file Header.h.

Referenced by llvm::gsym::Header::checkForError(), and llvm::gsym::Header::decode().