LLVM 23.0.0git
GlobalData.h
Go to the documentation of this file.
1//===- GlobalData.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_GLOBALDATA_H
10#define LLVM_DEBUGINFO_GSYM_GLOBALDATA_H
11
13#include "llvm/Support/Error.h"
14#include <cstdint>
15
16namespace llvm {
17
18namespace gsym {
19class FileWriter;
21
22/// GlobalInfoType allows GSYM files to encode global information within a GSYM
23/// file in a way that is extensible for future versions of GSYM. It is
24/// designed to contain information needed by the GSYM encoding, along with any
25/// common data that FunctionInfo InfoType entries might require.
28 // The address offsets table. It's a list of function addresses subtracted by
29 // the base address, hence "offset".
30 //
31 // This table and the address info offsets table (see below) have the same
32 // number of items. The items are 1-1 mapped.
33 //
34 // Given an address, this table is used to do a binary search to find the
35 // index into the address info offsets table, where the location of the
36 // FunctionInfo for the same function can be found in the GSYM.
38 // The address info offsets table. Each entry is an offset relative to a
39 // version-dependent reference position in the GSYM data where the
40 // FunctionInfo for the corresponding function can be found.
41 //
42 // In version 1, the reference position is the start of the GSYM data.
43 // In version 2 and later, the reference position is the start of the
44 // FunctionInfo section.
46 // The string table. It contains all the strings used by the rest of the GSYM.
47 // The exact storage of the strings is determined by
48 // HeaderV2::StrTableEncoding.
50 // The file table. It's a list of files, referred by FunctionInfo objects.
52 // A list of FunctionInfo objects, terminated by EndOfList.
54 // Optional UUID of the GSYM.
55 UUID = 6u,
56};
57
58/// GlobalData describes a section of data in a GSYM file by its type, file
59/// offset, and size. This is used to support 64-bit GSYM files where data
60/// sections can be located at arbitrary file offsets.
61struct GlobalData {
65
66 /// Encode this GlobalData entry into a FileWriter stream.
67 ///
68 /// \param O The binary stream to write the data to.
69 LLVM_ABI void encode(FileWriter &O) const;
70
71 /// Decode a GlobalData entry from a binary data stream.
72 ///
73 /// \param GsymData The binary stream to read from.
74 /// \param Offset The offset to start reading from. Updated on success.
75 /// \returns A GlobalData entry or an error.
78};
79
81
82} // namespace gsym
83} // namespace llvm
84
85#endif // LLVM_DEBUGINFO_GSYM_GLOBALDATA_H
#define LLVM_ABI
Definition Compiler.h:213
Tagged union holding either a T or a Error.
Definition Error.h:485
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
A simplified binary data writer class that doesn't require targets, target definitions,...
Definition FileWriter.h:30
A DataExtractor subclass that adds GSYM-specific string offset support.
LLVM_ABI StringRef getNameForGlobalInfoType(GlobalInfoType Type)
GlobalInfoType
GlobalInfoType allows GSYM files to encode global information within a GSYM file in a way that is ext...
Definition GlobalData.h:26
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:532
Function information in GSYM files encodes information for one contiguous address range.
GlobalData describes a section of data in a GSYM file by its type, file offset, and size.
Definition GlobalData.h:61
static LLVM_ABI llvm::Expected< GlobalData > decode(GsymDataExtractor &GsymData, uint64_t &Offset)
Decode a GlobalData entry from a binary data stream.
LLVM_ABI void encode(FileWriter &O) const
Encode this GlobalData entry into a FileWriter stream.
GlobalInfoType Type
Definition GlobalData.h:62
String tables in GSYM files are required to start with an empty string at offset zero.
Definition StringTable.h:22