9#ifndef LLVM_DEBUGINFO_GSYM_GSYMCREATOR_H
10#define LLVM_DEBUGINFO_GSYM_GSYMCREATOR_H
31class OutputAggregator;
136 mutable std::mutex
Mutex;
137 std::vector<FunctionInfo> Funcs;
143 std::vector<llvm::gsym::FileEntry> Files;
144 std::vector<uint8_t>
UUID;
145 std::optional<AddressRanges> ValidTextRanges;
146 std::optional<uint64_t> BaseAddress;
147 bool IsSegment =
false;
148 bool Finalized =
false;
156 std::optional<uint64_t> getFirstFunctionAddress()
const;
162 std::optional<uint64_t> getLastFunctionAddress()
const;
169 std::optional<uint64_t> getBaseAddress()
const;
179 uint8_t getAddressOffsetSize()
const;
189 uint64_t getMaxAddressOffset()
const;
204 uint64_t calculateHeaderAndTableSize()
const;
290 void setIsSegment() {
312 std::optional<uint64_t> SegmentSize = std::nullopt)
const;
413 std::function<
bool(
const FunctionInfo &)>
const &Callback)
const;
421 ValidTextRanges = TextRanges;
426 return ValidTextRanges;
uint64_t IntrinsicInst * II
StringSet - A set-like wrapper for the StringMap.
std::pair< llvm::MachO::Target, std::string > UUID
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,...
GsymCreator is used to emit GSYM data to a stand alone file or section within a file.
void addFunctionInfo(FunctionInfo &&FI)
Add a function info to this GSYM creator.
uint32_t insertString(StringRef S, bool Copy=true)
Insert a string into the GSYM string table.
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.
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::Error save(StringRef Path, llvm::endianness ByteOrder, std::optional< uint64_t > SegmentSize=std::nullopt) const
Save a GSYM file to a stand alone file.
void prepareMergedFunctions(OutputAggregator &Out)
Organize merged FunctionInfo's.
StringRef getString(uint32_t Offset)
Retrieve a string from the GSYM string table given its offset.
llvm::Error loadCallSitesFromYAML(StringRef YAMLFile)
Load call site information from a YAML file.
llvm::Error encode(FileWriter &O) const
Encode a GSYM into the file writer stream at the current position.
bool isQuiet() const
Whether the transformation should be quiet, i.e. not output warnings.
void setUUID(llvm::ArrayRef< uint8_t > UUIDBytes)
Set the UUID value.
void SetValidTextRanges(AddressRanges &TextRanges)
Set valid .text address ranges that all functions must be contained in.
uint32_t insertFile(StringRef Path, sys::path::Style Style=sys::path::Style::native)
Insert a file into this GSYM creator.
size_t getNumFunctionInfos() const
Get the current number of FunctionInfo objects contained in this object.
bool IsValidTextAddress(uint64_t Addr) const
Check if an address is a valid code address.
void forEachFunctionInfo(std::function< bool(FunctionInfo &)> const &Callback)
Thread safe iteration over all function infos.
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.