46 if (!
Data.isValidOffsetForDataOfSize(
Offset, 4))
48 "0x%8.8" PRIx64
": missing FunctionInfo Size",
Offset);
50 if (!
Data.isValidOffsetForDataOfSize(
Offset, 4))
52 "0x%8.8" PRIx64
": missing FunctionInfo Name",
Offset);
57 ": invalid FunctionInfo Name value 0x%" PRIx64,
61 if (!
Data.isValidOffsetForDataOfSize(
Offset, 4))
63 "0x%8.8" PRIx64
": missing FunctionInfo InfoType value",
Offset);
65 if (!
Data.isValidOffsetForDataOfSize(
Offset, 4))
67 "0x%8.8" PRIx64
": missing FunctionInfo InfoType length",
Offset);
69 if (!
Data.isValidOffsetForDataOfSize(
Offset, InfoLength))
71 "0x%8.8" PRIx64
": missing FunctionInfo data for InfoType %u",
83 return LT.takeError();
90 return II.takeError();
98 return MI.takeError();
106 return CI.takeError();
111 "0x%8.8" PRIx64
": unsupported InfoType %u",
116 return std::move(FI);
136 bool NoPadding)
const {
139 "attempted to encode invalid FunctionInfo object");
141 if (NoPadding ==
false)
153 return FuncInfoOffset;
166 const auto StartOffset = Out.
tell();
169 return std::move(err);
173 "LineTable length is greater than UINT32_MAX");
184 const auto StartOffset = Out.
tell();
187 return std::move(err);
191 "InlineInfo length is greater than UINT32_MAX");
202 const auto StartOffset = Out.
tell();
205 return std::move(err);
209 std::errc::invalid_argument,
210 "MergedFunctionsInfo length is greater than UINT32_MAX");
221 const auto StartOffset = Out.
tell();
224 return std::move(Err);
228 "CallSites length is greater than UINT32_MAX");
236 return FuncInfoOffset;
242 std::optional<GsymDataExtractor> *MergedFuncsData) {
253 "FunctionInfo data is truncated");
259 "address 0x%" PRIx64
" is not in GSYM", Addr);
264 ": invalid FunctionInfo Name value 0x0",
269 std::optional<GsymDataExtractor> InlineInfoData;
271 if (!
Data.isValidOffsetForDataOfSize(
Offset, 8))
273 "FunctionInfo data is truncated");
277 if (InfoLength != InfoBytes.
size())
279 "FunctionInfo data is truncated");
290 return ExpectedLE.takeError();
296 *MergedFuncsData = InfoData;
302 InlineInfoData = InfoData;
308 for (
const auto &CS : CSIC->CallSites) {
310 if (CS.ReturnOffset == Addr - FuncAddr) {
319 return CSIC.takeError();
334 SrcLoc.
Offset = Addr - FuncAddr;
342 "failed to extract file[%" PRIu32
"]",
347 SrcLoc.
Offset = Addr - FuncAddr;
360 return std::move(Err);
static cl::opt< ITMode > IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT), cl::values(clEnumValN(DefaultIT, "arm-default-it", "Generate any type of IT block"), clEnumValN(RestrictedIT, "arm-restrict-it", "Disallow complex IT blocks")))
InfoType
FunctionInfo information type that is used to encode the optional data that is associated with a Func...
uint64_t IntrinsicInst * II
bool contains(uint64_t Addr) const
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.
constexpr size_t size() const
size - Get the string size.
A simplified binary data writer class that doesn't require targets, target definitions,...
LLVM_ABI uint64_t tell()
Return the current offset within the file.
LLVM_ABI void fixup32(uint32_t Value, uint64_t Offset)
Fixup a uint32_t value at the specified offset in the stream.
LLVM_ABI void alignTo(size_t Align)
Pad with zeroes at the current file position until the current file position matches the specified al...
LLVM_ABI void writeStringOffset(uint64_t Value)
Write a string table offset of StringOffsetSize bytes into the stream.
LLVM_ABI void writeU32(uint32_t Value)
Write a single uint32_t value into the stream at the current file position.
void setStringOffsetSize(uint8_t Size)
Set the string offset size for this writer.
LLVM_ABI void writeData(llvm::ArrayRef< uint8_t > Data)
Write an array of uint8_t values into the stream at the current file position.
llvm::endianness getByteOrder() const
GsymCreator is used to emit GSYM data to a stand alone file or section within a file.
GsymReader is used to read GSYM data from a file or buffer.
StringRef getString(gsym_strp_t Offset) const
Get a string from the string table.
std::optional< FileEntry > getFile(uint32_t Index) const
Get the a file entry for the suppplied file index.
static LLVM_ABI Expected< LineEntry > lookup(GsymDataExtractor &Data, uint64_t BaseAddr, uint64_t Addr)
Lookup a single address within a line table's data.
static LLVM_ABI llvm::Expected< LineTable > decode(GsymDataExtractor &Data, uint64_t BaseAddr)
Decode an LineTable object from a binary data stream.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an SmallVector or SmallString.
uint64_t gsym_strp_t
The type of string offset used in the code.
LLVM_ABI raw_ostream & operator<<(raw_ostream &OS, const CallSiteInfo &CSI)
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
void consumeError(Error Err)
Consume a Error without doing anything.
static LLVM_ABI llvm::Expected< CallSiteInfoCollection > decode(GsymDataExtractor &Data)
Decode a CallSiteInfoCollection object from a binary data stream.
Function information in GSYM files encodes information for one contiguous address range.
std::optional< InlineInfo > Inline
std::optional< MergedFunctionsInfo > MergedFunctions
static LLVM_ABI llvm::Expected< FunctionInfo > decode(GsymDataExtractor &Data, uint64_t BaseAddr)
Decode an object from a binary data stream.
bool isValid() const
Query if a FunctionInfo object is valid.
std::optional< CallSiteInfoCollection > CallSites
FunctionInfo(uint64_t Addr=0, uint64_t Size=0, gsym_strp_t Name=0)
gsym_strp_t Name
String table offset in the string table.
LLVM_ABI llvm::Expected< uint64_t > encode(FileWriter &O, bool NoPadding=false) const
Encode this object into FileWriter stream.
SmallString< 32 > EncodingCache
If we encode a FunctionInfo during segmenting so we know its size, we can cache that encoding here so...
std::optional< LineTable > OptLineTable
LLVM_ABI uint64_t cacheEncoding(GsymCreator &GC)
Encode this function info into the internal byte cache and return the size in bytes.
static LLVM_ABI llvm::Expected< LookupResult > lookup(GsymDataExtractor &Data, const GsymReader &GR, uint64_t FuncAddr, uint64_t Addr, std::optional< GsymDataExtractor > *MergedFuncsData=nullptr)
Lookup an address within a FunctionInfo object's data stream.
Inline information stores the name of the inline function along with an array of address ranges.
static LLVM_ABI llvm::Expected< InlineInfo > decode(GsymDataExtractor &Data, uint64_t BaseAddr)
Decode an InlineInfo object from a binary data stream.
static LLVM_ABI llvm::Error lookup(const GsymReader &GR, GsymDataExtractor &Data, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs)
Lookup a single address within the inline info data.
Line entries are used to encode the line tables in FunctionInfo objects.
uint32_t File
1 based index of file in FileTable
uint32_t Line
Source line number.
uint64_t LookupAddr
The address that this lookup pertains to.
AddressRange FuncRange
The concrete function address range.
std::vector< StringRef > CallSiteFuncRegex
Function name regex patterns associated with a call site at the lookup address.
StringRef FuncName
The concrete function name that contains LookupAddr.
SourceLocations Locations
The source locations that match this address.
static LLVM_ABI llvm::Expected< MergedFunctionsInfo > decode(GsymDataExtractor &Data, uint64_t BaseAddr)
Decode an MergedFunctionsInfo object from a binary data stream.
StringRef Base
Line entry source file basename.
uint32_t Line
Source file line number.
uint32_t Offset
Byte size offset within the named function.
StringRef Dir
Line entry source file directory path.
StringRef Name
Function or symbol name.