9#ifndef LLVM_DEBUGINFO_GSYM_GSYMCREATOR_H
10#define LLVM_DEBUGINFO_GSYM_GSYMCREATOR_H
145 std::vector<llvm::gsym::FileEntry>
Files;
340 std::optional<uint64_t> SegmentSize = std::nullopt)
const;
441 std::function<
bool(
const FunctionInfo &)>
const &Callback)
const;
uint64_t IntrinsicInst * II
StringSet - A set-like wrapper for the StringMap.
The AddressRanges class helps normalize address range collections.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
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.
StringSet - A wrapper for StringMap that provides set-like functionality.
Utility for building string tables with deduplicated suffixes.
A simplified binary data writer class that doesn't require targets, target definitions,...
LLVM_ABI void addFunctionInfo(FunctionInfo &&FI)
Add a function info to this GSYM creator.
void fixupInlineInfo(const GsymCreator &SrcGC, InlineInfo &II)
Fixup any string and file references by updating any file indexes and strings offsets in the InlineIn...
std::vector< llvm::gsym::FileEntry > Files
uint64_t copyFunctionInfo(const GsymCreator &SrcGC, size_t FuncInfoIdx)
Copy a FunctionInfo from the SrcGC GSYM creator into this creator.
llvm::Error saveSegments(StringRef Path, llvm::endianness ByteOrder, uint64_t SegmentSize) const
Save this GSYM file into segments that are roughly SegmentSize in size.
virtual std::unique_ptr< GsymCreator > createNew(bool Quiet) const =0
Create a new empty creator of the same version.
llvm::Error validateForEncoding(std::optional< uint64_t > &BaseAddr) const
Validate that the creator is ready for encoding.
void setBaseAddress(uint64_t Addr)
Set the base address to use for the GSYM file.
const std::optional< AddressRanges > GetValidTextRanges() const
Get the valid text ranges.
gsym_strp_t copyString(const GsymCreator &SrcGC, gsym_strp_t StrOff)
Copy a string from SrcGC into this object.
std::optional< uint64_t > BaseAddress
llvm::Error encodeFileTable(FileWriter &O) const
Write the file table to the output stream.
LLVM_ABI gsym_strp_t insertString(StringRef S, bool Copy=true)
Insert a string into the GSYM string table.
LLVM_ABI llvm::Expected< std::unique_ptr< GsymCreator > > createSegment(uint64_t SegmentSize, size_t &FuncIdx) const
Create a segmented GSYM creator starting with function info index FuncIdx.
LLVM_ABI llvm::Error save(StringRef Path, llvm::endianness ByteOrder, std::optional< uint64_t > SegmentSize=std::nullopt) const
Save a GSYM file to a stand alone file.
LLVM_ABI StringRef getString(gsym_strp_t Offset)
Retrieve a string from the GSYM string table given its offset.
StringTableBuilder StrTab
LLVM_ABI void prepareMergedFunctions(OutputAggregator &Out)
Organize merged FunctionInfo's.
DenseMap< llvm::gsym::FileEntry, uint32_t > FileEntryToIndex
std::vector< uint8_t > UUID
std::optional< uint64_t > getFirstFunctionAddress() const
Get the first function start address.
std::optional< AddressRanges > ValidTextRanges
std::vector< FunctionInfo > Funcs
LLVM_ABI llvm::Error loadCallSitesFromYAML(StringRef YAMLFile)
Load call site information from a YAML file.
uint32_t insertFileEntry(FileEntry FE)
Inserts a FileEntry into the file table.
virtual uint8_t getStringOffsetSize() const =0
Get the size in bytes needed for encoding string offsets.
DenseMap< uint64_t, CachedHashStringRef > StringOffsetMap
bool isQuiet() const
Whether the transformation should be quiet, i.e. not output warnings.
virtual uint64_t calculateHeaderAndTableSize() const =0
Calculate the byte size of the GSYM header and tables sizes.
uint64_t getMaxAddressOffset() const
Get the maximum address offset for the current address offset size.
void setUUID(llvm::ArrayRef< uint8_t > UUIDBytes)
Set the UUID value.
std::optional< uint64_t > getLastFunctionAddress() const
Get the last function address.
void SetValidTextRanges(AddressRanges &TextRanges)
Set valid .text address ranges that all functions must be contained in.
uint32_t copyFile(const GsymCreator &SrcGC, uint32_t FileIdx)
Copy a file from SrcGC into this object.
LLVM_ABI uint32_t insertFile(StringRef Path, sys::path::Style Style=sys::path::Style::native)
Insert a file into this GSYM creator.
virtual ~GsymCreator()=default
virtual llvm::Error encode(FileWriter &O) const =0
Encode a GSYM into the file writer stream at the current position.
void setIsSegment()
Let this creator know that this is a segment of another GsymCreator.
LLVM_ABI size_t getNumFunctionInfos() const
Get the current number of FunctionInfo objects contained in this object.
void encodeAddrOffsets(FileWriter &O, uint8_t AddrOffSize, uint64_t BaseAddr) const
Write the address offsets table to the output stream.
std::optional< uint64_t > getBaseAddress() const
Get the base address to use for this GSYM file.
uint8_t getAddressOffsetSize() const
Get the size of an address offset in the address offset table.
LLVM_ABI bool IsValidTextAddress(uint64_t Addr) const
Check if an address is a valid code address.
LLVM_ABI void forEachFunctionInfo(std::function< bool(FunctionInfo &)> const &Callback)
Thread safe iteration over all function infos.
LLVM_ABI GsymCreator(bool Quiet=false)
uint64_t gsym_strp_t
The type of string offset used in the code.
This is an optimization pass for GlobalISel generic memory operations.
Files in GSYM are contained in FileEntry structs where we split the directory and basename into two d...
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.