LLVM 24.0.0git
GsymCreator.h
Go to the documentation of this file.
1//===- GsymCreator.h --------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_GSYM_GSYMCREATOR_H
10#define LLVM_DEBUGINFO_GSYM_GSYMCREATOR_H
11
13#include <functional>
14#include <memory>
15#include <mutex>
16#include <thread>
17
19#include "llvm/ADT/ArrayRef.h"
20#include "llvm/ADT/StringSet.h"
24#include "llvm/Support/Endian.h"
25#include "llvm/Support/Error.h"
26#include "llvm/Support/Path.h"
27
28namespace llvm {
29
30namespace object {
31class ObjectFile;
32}
33
34namespace gsym {
35class FileWriter;
37
38/// GsymCreator is used to emit GSYM data to a stand alone file or section
39/// within a file.
40///
41/// The GsymCreator is designed to be used in 3 stages:
42/// - Create FunctionInfo objects and add them
43/// - Finalize the GsymCreator object
44/// - Save to file or section
45///
46/// The first stage involves creating FunctionInfo objects from another source
47/// of information like compiler debug info metadata, DWARF or Breakpad files.
48/// Any strings in the FunctionInfo or contained information, like InlineInfo
49/// or LineTable objects, should get the string table offsets by calling
50/// GsymCreator::insertString(...). Any file indexes that are needed should be
51/// obtained by calling GsymCreator::insertFile(...). All of the function calls
52/// in GsymCreator are thread safe. This allows multiple threads to create and
53/// add FunctionInfo objects while parsing debug information.
54///
55/// Once all of the FunctionInfo objects have been added, the
56/// GsymCreator::finalize(...) must be called prior to saving. This function
57/// will sort the FunctionInfo objects, finalize the string table, and do any
58/// other passes on the information needed to prepare the information to be
59/// saved.
60///
61/// Once the object has been finalized, it can be saved to a file or section.
62///
63/// ENCODING
64///
65/// GSYM files are designed to be memory mapped into a process as shared, read
66/// only data, and used as is.
67///
68/// The GSYM file format when in a stand alone file consists of:
69/// - Header
70/// - Address Table
71/// - Function Info Offsets
72/// - File Table
73/// - String Table
74/// - Function Info Data
75///
76/// HEADER
77///
78/// The header is fully described in "llvm/DebugInfo/GSYM/Header.h".
79///
80/// ADDRESS TABLE
81///
82/// The address table immediately follows the header in the file and consists
83/// of Header.NumAddresses address offsets. These offsets are sorted and can be
84/// binary searched for efficient lookups. Addresses in the address table are
85/// stored as offsets from a 64 bit base address found in Header.BaseAddress.
86/// This allows the address table to contain 8, 16, or 32 offsets. This allows
87/// the address table to not require full 64 bit addresses for each address.
88/// The resulting GSYM size is smaller and causes fewer pages to be touched
89/// during address lookups when the address table is smaller. The size of the
90/// address offsets in the address table is specified in the header in
91/// Header.AddrOffSize. The first offset in the address table is aligned to
92/// Header.AddrOffSize alignment to ensure efficient access when loaded into
93/// memory.
94///
95/// FUNCTION INFO OFFSETS TABLE
96///
97/// The function info offsets table immediately follows the address table and
98/// consists of Header.NumAddresses 32 bit file offsets: one for each address
99/// in the address table. This data is aligned to a 4 byte boundary. The
100/// offsets in this table are the relative offsets from the start offset of the
101/// GSYM header and point to the function info data for each address in the
102/// address table. Keeping this data separate from the address table helps to
103/// reduce the number of pages that are touched when address lookups occur on a
104/// GSYM file.
105///
106/// FILE TABLE
107///
108/// The file table immediately follows the function info offsets table. The
109/// encoding of the FileTable is:
110///
111/// struct FileTable {
112/// uint32_t Count;
113/// FileEntry Files[];
114/// };
115///
116/// The file table starts with a 32 bit count of the number of files that are
117/// used in all of the function info, followed by that number of FileEntry
118/// structures. The file table is aligned to a 4 byte boundary, Each file in
119/// the file table is represented with a FileEntry structure.
120/// See "llvm/DebugInfo/GSYM/FileEntry.h" for details.
121///
122/// STRING TABLE
123///
124/// The string table follows the file table in stand alone GSYM files and
125/// contains all strings for everything contained in the GSYM file. Any string
126/// data should be added to the string table and any references to strings
127/// inside GSYM information must be stored as 32 bit string table offsets into
128/// this string table. The string table always starts with an empty string at
129/// offset zero and is followed by any strings needed by the GSYM information.
130/// The start of the string table is not aligned to any boundary.
131///
132/// FUNCTION INFO DATA
133///
134/// The function info data is the payload that contains information about the
135/// address that is being looked up. It contains all of the encoded
136/// FunctionInfo objects. Each encoded FunctionInfo's data is pointed to by an
137/// entry in the Function Info Offsets Table. For details on the exact encoding
138/// of FunctionInfo objects, see "llvm/DebugInfo/GSYM/FunctionInfo.h".
140protected:
141 // Private member variables require Mutex protections
142 mutable std::mutex Mutex;
143 std::vector<FunctionInfo> Funcs;
147 // Needed for mapping string offsets back to the string stored in \a StrTab.
149 std::vector<llvm::gsym::FileEntry> Files;
150 std::vector<uint8_t> UUID;
151 std::optional<AddressRanges> ValidTextRanges;
152 std::optional<uint64_t> BaseAddress;
153 bool IsSegment = false;
154 bool Finalized = false;
155
156 /// Get the first function start address.
157 ///
158 /// \returns The start address of the first FunctionInfo or std::nullopt if
159 /// there are no function infos.
160 LLVM_ABI std::optional<uint64_t> getFirstFunctionAddress() const;
161
162 /// Get the last function address.
163 ///
164 /// \returns The start address of the last FunctionInfo or std::nullopt if
165 /// there are no function infos.
166 LLVM_ABI std::optional<uint64_t> getLastFunctionAddress() const;
167
168 /// Get the base address to use for this GSYM file.
169 ///
170 /// \returns The base address to put into the header and to use when creating
171 /// the address offset table or std::nullpt if there are no valid
172 /// function infos or if the base address wasn't specified.
173 LLVM_ABI std::optional<uint64_t> getBaseAddress() const;
174
175 /// Get the size of an address offset in the address offset table.
176 ///
177 /// GSYM files store offsets from the base address in the address offset table
178 /// and we store the size of the address offsets in the GSYM header. This
179 /// function will calculate the size in bytes of these address offsets based
180 /// on the current contents of the GSYM file.
181 ///
182 /// \returns The size in byets of the address offsets.
184
185 /// Get the maximum address offset for the current address offset size.
186 ///
187 /// This is used when creating the address offset table to ensure we have
188 /// values that are in range so we don't end up truncating address offsets
189 /// when creating GSYM files as the code evolves.
190 ///
191 /// \returns The maximum address offset value that will be encoded into a GSYM
192 /// file.
194
195 /// Calculate the byte size of the GSYM header and tables sizes.
196 ///
197 /// This is used to help split GSYM files into segments.
198 ///
199 /// \returns Size in bytes the GSYM header and tables.
201
202 /// Copy a FunctionInfo from the \a SrcGC GSYM creator into this creator.
203 ///
204 /// Copy the function info and only the needed files and strings and add a
205 /// converted FunctionInfo into this object. This is used to segment GSYM
206 /// files into separate files while only transferring the files and strings
207 /// that are needed from \a SrcGC.
208 ///
209 /// \param SrcGC The source gsym creator to copy from.
210 /// \param FuncInfoIdx The function info index within \a SrcGC to copy.
211 /// \returns The number of bytes it will take to encode the function info in
212 /// this GsymCreator. This helps calculate the size of the current GSYM
213 /// segment file.
215 size_t FuncInfoIdx);
216
217 /// Copy a string from \a SrcGC into this object.
218 ///
219 /// Copy a string from \a SrcGC by string table offset into this GSYM creator.
220 /// If a string has already been copied, the uniqued string table offset will
221 /// be returned, otherwise the string will be copied and a unique offset will
222 /// be returned.
223 ///
224 /// \param SrcGC The source gsym creator to copy from.
225 /// \param StrOff The string table offset from \a SrcGC to copy.
226 /// \returns The new string table offset of the string within this object.
228
229 /// Copy a file from \a SrcGC into this object.
230 ///
231 /// Copy a file from \a SrcGC by file index into this GSYM creator. Files
232 /// consist of two string table entries, one for the directory and one for the
233 /// filename, this function will copy any needed strings ensure the file is
234 /// uniqued within this object. If a file already exists in this GSYM creator
235 /// the uniqued index will be returned, else the stirngs will be copied and
236 /// the new file index will be returned.
237 ///
238 /// \param SrcGC The source gsym creator to copy from.
239 /// \param FileIdx The 1 based file table index within \a SrcGC to copy. A
240 /// file index of zero will always return zero as the zero is a reserved file
241 /// index that means no file.
242 /// \returns The new file index of the file within this object.
243 LLVM_ABI uint32_t copyFile(const GsymCreator &SrcGC, uint32_t FileIdx);
244
245 /// Inserts a FileEntry into the file table.
246 ///
247 /// This is used to insert a file entry in a thread safe way into this object.
248 ///
249 /// \param FE A file entry object that contains valid string table offsets
250 /// from this object already.
252
253 /// Fixup any string and file references by updating any file indexes and
254 /// strings offsets in the InlineInfo parameter.
255 ///
256 /// When copying InlineInfo entries, we can simply make a copy of the object
257 /// and then fixup the files and strings for efficiency.
258 ///
259 /// \param SrcGC The source gsym creator to copy from.
260 /// \param II The inline info that contains file indexes and string offsets
261 /// that come from \a SrcGC. The entries will be updated by coping any files
262 /// and strings over into this object.
263 LLVM_ABI void fixupInlineInfo(const GsymCreator &SrcGC, InlineInfo &II);
264
265 /// Save this GSYM file into segments that are roughly \a SegmentSize in size.
266 ///
267 /// When segemented GSYM files are saved to disk, they will use \a Path as a
268 /// prefix and then have the first function info address appended to the path
269 /// when each segment is saved. Each segmented GSYM file has a only the
270 /// strings and files that are needed to save the function infos that are in
271 /// each segment. These smaller files are easy to compress and download
272 /// separately and allow for efficient lookups with very large GSYM files and
273 /// segmenting them allows servers to download only the segments that are
274 /// needed.
275 ///
276 /// \param Path The path prefix to use when saving the GSYM files.
277 /// \param ByteOrder The endianness to use when saving the file.
278 /// \param SegmentSize The size in bytes to segment the GSYM file into.
280 uint64_t SegmentSize) const;
281
282 /// Let this creator know that this is a segment of another GsymCreator.
283 ///
284 /// When we have a segment, we know that function infos will be added in
285 /// ascending address range order without having to be finalized. We also
286 /// don't need to sort and unique entries during the finalize function call.
288 IsSegment = true;
289 }
290
291 /// Validate that the creator is ready for encoding.
292 ///
293 /// Checks that functions exist, the creator is finalized, the function count
294 /// fits in 32 bits, and the base address is valid.
295 ///
296 /// \param[out] BaseAddr Set to the base address on success.
297 /// \returns An error if validation fails, or Error::success().
299 validateForEncoding(std::optional<uint64_t> &BaseAddr) const;
300
301 /// Write the address offsets table to the output stream.
302 ///
303 /// \param O The file writer to write to.
304 /// \param AddrOffSize The byte width of each address offset.
305 /// \param BaseAddr The base address to subtract from each function address.
306 LLVM_ABI void encodeAddrOffsets(FileWriter &O, uint8_t AddrOffSize,
307 uint64_t BaseAddr) const;
308
309 /// Write the file table to the output stream.
310 ///
311 /// \param O The file writer to write to.
312 /// \returns An error if the file table is too large, or Error::success().
314
315 /// Create a new empty creator of the same version.
316 ///
317 /// Used by createSegment() to create segment creators of the correct
318 /// version type.
319 virtual std::unique_ptr<GsymCreator> createNew() const = 0;
320
321public:
323 virtual ~GsymCreator() = default;
324
325 /// Get the size in bytes needed for encoding string offsets.
326 virtual uint8_t getStringOffsetSize() const = 0;
327
328 /// Save a GSYM file to a stand alone file.
329 ///
330 /// \param Path The file path to save the GSYM file to.
331 /// \param ByteOrder The endianness to use when saving the file.
332 /// \param SegmentSize The size in bytes to segment the GSYM file into. If
333 /// this option is set this function will create N segments
334 /// that are all around \a SegmentSize bytes in size. This
335 /// allows a very large GSYM file to be broken up into
336 /// shards. Each GSYM file will have its own file table,
337 /// and string table that only have the files and strings
338 /// needed for the shared. If this argument has no value,
339 /// a single GSYM file that contains all function
340 /// information will be created.
341 /// \returns An error object that indicates success or failure of the save.
343 save(StringRef Path, llvm::endianness ByteOrder,
344 std::optional<uint64_t> SegmentSize = std::nullopt) const;
345
346 /// Encode a GSYM into the file writer stream at the current position.
347 ///
348 /// \param O The stream to save the binary data to
349 /// \returns An error object that indicates success or failure of the save.
350 virtual llvm::Error encode(FileWriter &O) const = 0;
351
352 /// Insert a string into the GSYM string table.
353 ///
354 /// All strings used by GSYM files must be uniqued by adding them to this
355 /// string pool and using the returned offset for any string values.
356 ///
357 /// \param S The string to insert into the string table.
358 /// \param Copy If true, then make a backing copy of the string. If false,
359 /// the string is owned by another object that will stay around
360 /// long enough for the GsymCreator to save the GSYM file.
361 /// \returns The unique 32 bit offset into the string table.
362 LLVM_ABI gsym_strp_t insertString(StringRef S, bool Copy = true);
363
364 /// Retrieve a string from the GSYM string table given its offset.
365 ///
366 /// The offset is assumed to be a valid offset into the string table.
367 /// otherwise an assert will be triggered.
368 ///
369 /// \param Offset The offset of the string to retrieve, previously returned by
370 /// insertString.
371 /// \returns The string at the given offset in the string table.
373
374 /// Insert a file into this GSYM creator.
375 ///
376 /// Inserts a file by adding a FileEntry into the "Files" member variable if
377 /// the file has not already been added. The file path is split into
378 /// directory and filename which are both added to the string table. This
379 /// allows paths to be stored efficiently by reusing the directories that are
380 /// common between multiple files.
381 ///
382 /// \param Path The path to the file to insert.
383 /// \param Style The path style for the "Path" parameter.
384 /// \returns The unique file index for the inserted file.
387
388 /// Add a function info to this GSYM creator.
389 ///
390 /// All information in the FunctionInfo object must use the
391 /// GsymCreator::insertString(...) function when creating string table
392 /// offsets for names and other strings.
393 ///
394 /// \param FI The function info object to emplace into our functions list.
396
397 /// Load call site information from a YAML file.
398 ///
399 /// This function reads call site information from a specified YAML file and
400 /// adds it to the GSYM data.
401 ///
402 /// \param YAMLFile The path to the YAML file containing call site
403 /// information.
405
406 /// Organize merged FunctionInfo's
407 ///
408 /// This method processes the list of function infos (Funcs) to identify and
409 /// group functions with overlapping address ranges.
410 ///
411 /// \param Out Output stream to report information about how merged
412 /// FunctionInfo's were handled.
414
415 /// Finalize the data in the GSYM creator prior to saving the data out.
416 ///
417 /// Finalize must be called after all FunctionInfo objects have been added
418 /// and before GsymCreator::save() is called.
419 ///
420 /// \param OS Output stream to report duplicate function infos, overlapping
421 /// function infos, and function infos that were merged or removed.
422 /// \param Obj An optional object file that the function infos were created
423 /// from. The last function info often has no size, and its size gets
424 /// filled in from the valid text ranges. A valid text range can span
425 /// more than one section, so the object file is used to find the
426 /// section that contains the function and keep the size from
427 /// extending past the end of that section. If no object file is
428 /// supplied the size is filled in from the valid text ranges alone.
429 /// \returns An error object that indicates success or failure of the
430 /// finalize.
432 const object::ObjectFile *Obj = nullptr);
433
434 /// Set the UUID value.
435 ///
436 /// \param UUIDBytes The new UUID bytes.
438 UUID.assign(UUIDBytes.begin(), UUIDBytes.end());
439 }
440
441 /// Thread safe iteration over all function infos.
442 ///
443 /// \param Callback A callback function that will get called with each
444 /// FunctionInfo. If the callback returns false, stop iterating.
445 LLVM_ABI void
446 forEachFunctionInfo(std::function<bool(FunctionInfo &)> const &Callback);
447
448 /// Thread safe const iteration over all function infos.
449 ///
450 /// \param Callback A callback function that will get called with each
451 /// FunctionInfo. If the callback returns false, stop iterating.
453 std::function<bool(const FunctionInfo &)> const &Callback) const;
454
455 /// Get the current number of FunctionInfo objects contained in this
456 /// object.
457 LLVM_ABI size_t getNumFunctionInfos() const;
458
459 /// Set valid .text address ranges that all functions must be contained in.
461 ValidTextRanges = TextRanges;
462 }
463
464 /// Get the valid text ranges.
465 const std::optional<AddressRanges> GetValidTextRanges() const {
466 return ValidTextRanges;
467 }
468
469 /// Check if an address is a valid code address.
470 ///
471 /// Any functions whose addresses do not exist within these function bounds
472 /// will not be converted into the final GSYM. This allows the object file
473 /// to figure out the valid file address ranges of all the code sections
474 /// and ensure we don't add invalid functions to the final output. Many
475 /// linkers have issues when dead stripping functions from DWARF debug info
476 /// where they set the DW_AT_low_pc to zero, but newer DWARF has the
477 /// DW_AT_high_pc as an offset from the DW_AT_low_pc and these size
478 /// attributes have no relocations that can be applied. This results in DWARF
479 /// where many functions have an DW_AT_low_pc of zero and a valid offset size
480 /// for DW_AT_high_pc. If we extract all valid ranges from an object file
481 /// that are marked with executable permissions, we can properly ensure that
482 /// these functions are removed.
483 ///
484 /// \param Addr An address to check.
485 ///
486 /// \returns True if the address is in the valid text ranges or if no valid
487 /// text ranges have been set, false otherwise.
488 LLVM_ABI bool IsValidTextAddress(uint64_t Addr) const;
489
490 /// Set the base address to use for the GSYM file.
491 ///
492 /// Setting the base address to use for the GSYM file. Object files typically
493 /// get loaded from a base address when the OS loads them into memory. Using
494 /// GSYM files for symbolication becomes easier if the base address in the
495 /// GSYM header is the same address as it allows addresses to be easily slid
496 /// and allows symbolication without needing to find the original base
497 /// address in the original object file.
498 ///
499 /// \param Addr The address to use as the base address of the GSYM file
500 /// when it is saved to disk.
502 BaseAddress = Addr;
503 }
504
505 /// Create a segmented GSYM creator starting with function info index
506 /// \a FuncIdx.
507 ///
508 /// This function will create a GsymCreator object that will encode into
509 /// roughly \a SegmentSize bytes and return it. It is used by the private
510 /// saveSegments(...) function and also is used by the GSYM unit tests to test
511 /// segmenting of GSYM files. The returned GsymCreator can be finalized and
512 /// encoded.
513 ///
514 /// \param [in] SegmentSize The size in bytes to roughly segment the GSYM file
515 /// into.
516 /// \param [in,out] FuncIdx The index of the first function info to encode
517 /// into the returned GsymCreator. This index will be updated so it can be
518 /// used in subsequent calls to this function to allow more segments to be
519 /// created.
520 /// \returns An expected unique pointer to a GsymCreator or an error. The
521 /// returned unique pointer can be NULL if there are no more functions to
522 /// encode.
524 createSegment(uint64_t SegmentSize, size_t &FuncIdx) const;
525};
526
527} // namespace gsym
528} // namespace llvm
529
530#endif // LLVM_DEBUGINFO_GSYM_GSYMCREATOR_H
unsigned uint64_t
arc branch finalize
#define LLVM_ABI
Definition Compiler.h:215
uint64_t IntrinsicInst * II
StringSet - A set-like wrapper for the StringMap.
The AddressRanges class helps normalize address range collections.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
iterator end() const
Definition ArrayRef.h:130
iterator begin() const
Definition ArrayRef.h:129
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
StringSet - A wrapper for StringMap that provides set-like functionality.
Definition StringSet.h:25
Utility for building string tables with deduplicated suffixes.
A simplified binary data writer class that doesn't require targets, target definitions,...
Definition FileWriter.h:30
LLVM_ABI void addFunctionInfo(FunctionInfo &&FI)
Add a function info to this GSYM creator.
LLVM_ABI 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
LLVM_ABI uint64_t copyFunctionInfo(const GsymCreator &SrcGC, size_t FuncInfoIdx)
Copy a FunctionInfo from the SrcGC GSYM creator into this creator.
LLVM_ABI llvm::Error saveSegments(StringRef Path, llvm::endianness ByteOrder, uint64_t SegmentSize) const
Save this GSYM file into segments that are roughly SegmentSize in size.
LLVM_ABI 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.
LLVM_ABI 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_ABI 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
LLVM_ABI 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.
LLVM_ABI 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
virtual uint64_t calculateHeaderAndTableSize() const =0
Calculate the byte size of the GSYM header and tables sizes.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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 std::unique_ptr< GsymCreator > createNew() const =0
Create a new empty creator of the same version.
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.
LLVM_ABI void encodeAddrOffsets(FileWriter &O, uint8_t AddrOffSize, uint64_t BaseAddr) const
Write the address offsets table to the output stream.
LLVM_ABI std::optional< uint64_t > getBaseAddress() const
Get the base address to use for this GSYM file.
LLVM_ABI 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.
This class is the base class for all object file types.
Definition ObjectFile.h:231
uint64_t gsym_strp_t
The type of string offset used in the code.
Definition GsymTypes.h:21
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
endianness
Definition bit.h:71
Files in GSYM are contained in FileEntry structs where we split the directory and basename into two d...
Definition FileEntry.h:25
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.
Definition InlineInfo.h:61