17uint64_t GsymCreatorV1::calculateHeaderAndTableSize()
const {
18 uint64_t
Size =
sizeof(Header);
19 const size_t NumFuncs =
Funcs.size();
21 Size += NumFuncs *
sizeof(uint32_t);
28 std::lock_guard<std::mutex> Guard(
Mutex);
41 memset(Hdr.
UUID, 0,
sizeof(Hdr.
UUID));
55 const uint64_t AddrInfoOffsetsOffset = O.tell();
56 for (
size_t i = 0, n =
Funcs.size(); i < n; ++i)
63 const uint64_t StrtabOffset = O.tell();
64 StrTab.write(O.get_stream());
65 const uint64_t StrtabSize = O.tell() - StrtabOffset;
68 if (StrtabSize > UINT32_MAX) {
70 "string table size exceeded 32-bit max");
73 for (
const auto &FuncInfo :
Funcs) {
78 "address info offset exceeded 32-bit max");
82 return OffsetOrErr.takeError();
89 O.fixup32(AddrInfoOffset, AddrInfoOffsetsOffset +
Offset);
#define offsetof(TYPE, MEMBER)
Subclass of Error for the sole purpose of identifying the success path in the type system.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
A simplified binary data writer class that doesn't require targets, target definitions,...
LLVM_ABI llvm::Error encode(FileWriter &O) const override
Encode a GSYM into the file writer stream at the current position.
uint8_t getStringOffsetSize() const override
Get the size in bytes needed for encoding string offsets.
std::vector< llvm::gsym::FileEntry > Files
llvm::Error validateForEncoding(std::optional< uint64_t > &BaseAddr) const
Validate that the creator is ready for encoding.
std::optional< uint64_t > BaseAddress
llvm::Error encodeFileTable(FileWriter &O) const
Write the file table to the output stream.
StringTableBuilder StrTab
std::vector< uint8_t > UUID
std::vector< FunctionInfo > Funcs
void encodeAddrOffsets(FileWriter &O, uint8_t AddrOffSize, uint64_t BaseAddr) const
Write the address offsets table to the output stream.
uint8_t getAddressOffsetSize() const
Get the size of an address offset in the address offset table.
constexpr uint32_t GSYM_MAGIC
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.
static constexpr uint64_t getEncodedSize(uint8_t StringOffsetSize)
Returns the on-disk encoded size of a FileEntry for the given string offset size.